Index inheritance
Example:
Class Aclass [ Abstract ]
{
Index TXSBI On TextSearch(KEYS);
Index TXSSI On TextSimilarity(KEYS) [ Data = TextSimilarity(ELEMENTS) ];
Property TextSearch As %Text(LANGUAGECLASS = "%ZText.Czech", MAXLEN = 1000, XMLPROJECTION = "NONE");
Property TextSimilarity As %Text(LANGUAGECLASS = "%ZText.CzechSim", MAXLEN = 1000, SIMILARITYINDEX = "TXSSI", XMLPROJECTION = "NONE");
...
//other code
Class AAclass Extends (%Persistent, ClassType.SuperClass, Aclass, Bclass...)
{
}
Is there a way to inherit indexes? (without defining these indices) ^AAclassI("TXSSI" ...
Do you have any advice on how to do this?
Thank you
Generally I'd do this as follows:
Class DC.Demo.DefinesIndices Extends %Persistent [ Abstract, NoExtent ] { Index TXSBI On TextSearch(KEYS); Index TXSSI On TextSimilarity(KEYS) [ Data = TextSimilarity(ELEMENTS) ]; Property TextSearch As %Text(LANGUAGECLASS = "%Text.English", MAXLEN = 1000, XMLPROJECTION = "NONE"); Property TextSimilarity As %Text(LANGUAGECLASS = "%Text.English", MAXLEN = 1000, SIMILARITYINDEX = "TXSSI", XMLPROJECTION = "NONE"); } Class DC.Demo.InheritsIndices Extends DC.Demo.DefinesIndices { Storage Default { <Data name="InheritsIndicesDefaultData"> <Value name="1"> <Value>%%CLASSNAME</Value> </Value> <Value name="2"> <Value>TextSearch</Value> </Value> <Value name="3"> <Value>TextSimilarity</Value> </Value> </Data> <DataLocation>^DC.Demo.InheritsIndicesD</DataLocation> <DefaultData>InheritsIndicesDefaultData</DefaultData> <IdLocation>^DC.Demo.InheritsIndicesD</IdLocation> <IndexLocation>^DC.Demo.InheritsIndicesI</IndexLocation> <StreamLocation>^DC.Demo.InheritsIndicesS</StreamLocation> <Type>%Storage.Persistent</Type> } }
Key points:
Thanks for the reply. Unfortunately, this solution will not help me. I want to extend some classes by inheriting them from other classes (with some properties, methods, indexes). This property inheritance adds this data to the storage (global ^ xD). But the index is not stored in ^ xI because it is not the first superclass.
Here's what I found:
IndexClass (%Dictionary.ClassDefinition)
IndexClass (%Dictionary.CompiledClass)
That is, you can write something like this:
The same applies to MemberSuper.
Unfortunately, I haven't found any examples of how to use it or if it works at all.
Thanks for the reply. Unfortunately, this solution will not help me. It does not create an index global. Probably because I use several superclasses.