Created
March 11, 2016 14:48
-
-
Save eduard93/ab284a73d155ee73a706 to your computer and use it in GitHub Desktop.
Include only some records into the index, the low-level way
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<Export generator="Cache" version="25" zv="Cache for Windows (x86-64) 2015.1.1 (Build 505U)" ts="2016-03-11 17:41:46"> | |
<Class name="Utils.Index"> | |
<Super>%Persistent</Super> | |
<TimeChanged>63988,63646.134181</TimeChanged> | |
<TimeCreated>63988,50153.308704</TimeCreated> | |
<Property name="Name"> | |
<Type>%String</Type> | |
</Property> | |
<Index name="NewIndex2"> | |
<Properties>Name</Properties> | |
</Index> | |
<Method name="%FileIndices"> | |
<Description> | |
This is a generated and modified method %FileIndices | |
It is generated by $$GenerateIndexFiler^%ocsCache4.mac | |
You'll need to write a real generator instead of this copy-paste</Description> | |
<Internal>1</Internal> | |
<ClassMethod>1</ClassMethod> | |
<FormalSpec><![CDATA[id:%String(MAXLEN=""),&pIndexHandle:%Binary]]></FormalSpec> | |
<ProcedureBlock>1</ProcedureBlock> | |
<ReturnType>%Status</ReturnType> | |
<ServerOnly>1</ServerOnly> | |
<Implementation><![CDATA[ | |
s $ZTrap="CatchError",sc=1 | |
Set bsv0N2=$Get(^Utils.IndexD(id)) | |
Set bsv0N3=$listget(bsv0N2,1) | |
if bsv0N3'="" { set bsv0N1=$piece(bsv0N3,$extract(bsv0N3),$length(bsv0N3,$extract(bsv0N3))-1) set:bsv0N1'["." bsv0N1="User."_bsv0N1 if bsv0N1'=$classname() { quit $classmethod(bsv0N1,"%FileIndices",id,.pIndexHandle) }} | |
If ('pIndexHandle)||($Ascii($Get(pIndexHandle("Utils.Index")),1)=1) { | |
Set bsv0N4=" "_$listget(bsv0N2,2) | |
If $listget(bsv0N2,2)'="" { // Added this check | |
Set ^Utils.IndexI("NewIndex2",bsv0N4,id)=$listget(bsv0N2,1) | |
} | |
} | |
QUIT 1 | |
CatchError s $ZTrap="" i $ZE'="" { s sc = $$Error^%apiOBJ(5002,$ZE) } q sc | |
]]></Implementation> | |
</Method> | |
<Method name="Test"> | |
<Description> | |
do ##class(Utils.Index).Test()</Description> | |
<ClassMethod>1</ClassMethod> | |
<Implementation><![CDATA[ | |
do ..%KillExtent() | |
set obj = ..%New() | |
set obj.Name = "A" | |
do obj.%Save() | |
set obj = ..%New() | |
do obj.%Save() | |
set obj = ..%New() | |
set obj.Name = "C" | |
do obj.%Save() | |
do ..%BuildIndices() | |
zw ^Utils.IndexI | |
]]></Implementation> | |
</Method> | |
<Storage name="Default"> | |
<Type>%Library.CacheStorage</Type> | |
<DataLocation>^Utils.IndexD</DataLocation> | |
<DefaultData>IndexDefaultData</DefaultData> | |
<IdLocation>^Utils.IndexD</IdLocation> | |
<IndexLocation>^Utils.IndexI</IndexLocation> | |
<StreamLocation>^Utils.IndexS</StreamLocation> | |
<Data name="IndexDefaultData"> | |
<Value name="1"> | |
<Value>%%CLASSNAME</Value> | |
</Value> | |
<Value name="2"> | |
<Value>Name</Value> | |
</Value> | |
</Data> | |
</Storage> | |
</Class> | |
</Export> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment