GlobalObjects
Loading...
Searching...
No Matches
GlobalObjects Indices

General information

To speed up the finding of objects in the object database, all objects are automatically indexed by a glo::ObjID.

In addition, individual indexes can be defined for each persistent class, even composed of several attributes.

Possible index attribute types:

Since a class can also have embedded and otherwise referenced classes as attributes, the attributes of these classes can also be used for indexing. A prerequisite is that the referenced classes are marked as dependent (embedded classes are automatically so).

Attribute types that can be used as a path to an index attribute:

Note
A compound index of referenced classes is only updated when the object of the indexed class is saved (saves its objects marked as dependent with). If only the referenced object with the index attribute is saved, the index of the referencing object is not updated.

Basically the indexes are stored as strings in a corresponding index file.



Index declaration in GloDevelloper

To be able to search for objects using attribute contents, an index definition is required. An index can also consist of several attributes (for example, last name and first name). Such indexes of persistent class attributes can be easily set up in the GloDeveloper. See there under Create / edit index.



Index query in AllSet

An AllSet can be instantiated with an index or an index can be set (see glo::TAllSet::setIndexName( const std::string & rsIndexName ) ) if an index is defined in the schema (see also Definition in the GlobalObjects schema). When iterating through the objects, the sorting of the selected index is used.

If an index is set, it is possible to filter the output when iterating through the AllSet (see glo::TAllSet::setIndexFilter( const std::string & rsIndexFilter ), glo::TAllSet::setIndexFilter( const std::string & rsIndexFilter, glo::EnComparisionOp eComparisionOp ) and glo::TAllSet::setIndexFilter( const std::string & rsRangeStartIndexFilter, const std::string & rsRangeEndIndexFilter ).

An AllSet can, if an index is available (see also glo::TAllSet::getAvailableIndices() ), return result sets, which can be restricted as with filtering (see
glo::TAllSet::getIndexedObjIds( std::list< glo::ObjID > & rObjIDList, const std::string & rsIndexSearchValue, glo::EnQueryType eQuerryType ),
glo::TAllSet::getIndexedObjIds( std::list< glo::ObjID > & rObjIDList, const std::string & rsIndexName, const std::string & rsIndexSearchValue, glo::EnQueryType eQuerryType ),
glo::TAllSet::getIndexedObjIds( std::list< glo::ObjID > & rObjIDList, const std::string & rsIndexName, unsigned long ulIndexClassID, const std::string & rsIndexSearchValue, glo::EnQueryType eQuerryType ),
glo::TAllSet::getIndexedObjIds( std::list< glo::ObjID > & rObjIDList, const std::string & rsIndexSearchValue, glo::EnComparisionOp eComparisionOp ),
glo::TAllSet::getIndexedObjIds( std::list< glo::ObjID > & rObjIDList, const std::string & rsIndexName, const std::string & rsIndexSearchValue, glo::EnComparisionOp eComparisionOp ),
glo::TAllSet::getIndexedObjIds( std::list< glo::ObjID > & rObjIDList, const std::string & rsIndexName, unsigned long ulIndexClassID, const std::string & rsIndexSearchValue, glo::EnComparisionOp eComparisionOp ),
glo::TAllSet::getIndexedObjIds( std::list< glo::ObjID > & rObjIDList, const std::string & rsRangeStartIndexSearchValue, const std::string & rsRangeEndIndexSearchValue ),
glo::TAllSet::getIndexedObjIds( std::list< glo::ObjID > & rObjIDList, const std::string & rsIndexName, const std::string & rsRangeStartIndexSearchValue, const std::string & rsRangeEndIndexSearchValue ),
glo::TAllSet::getIndexedObjIds( std::list< glo::ObjID > & rObjIDList, const std::string & rsIndexName, unsigned long ulIndexClassID, const std::string & rsRangeStartIndexSearchValue, const std::string & rsRangeEndIndexSearchValue ),
glo::TAllSet::getIndexedOndemands( std::vector< glo::TOndemand<T> > & rOndemandVector, const std::string & rsIndexSearchValue, glo::EnQueryType eQuerryType ),
glo::TAllSet::getIndexedOndemands( std::vector< glo::TOndemand<T> > & rOndemandVector, const std::string & rsIndexName, const std::string & rsIndexSearchValue, glo::EnQueryType eQuerryType ),
glo::TAllSet::getIndexedOndemands( std::vector< glo::TOndemand<T> > & rOndemandVector, const std::string & rsIndexName, unsigned long ulIndexClassID, const std::string & rsIndexSearchValue, glo::EnQueryType eQuerryType ),
glo::TAllSet::getIndexedOndemands( std::vector< glo::TOndemand<T> > & rOndemandVector, const std::string & rsIndexSearchValue, glo::EnComparisionOp eComparisionOp ),
glo::TAllSet::getIndexedOndemands( std::vector< glo::TOndemand<T> > & rOndemandVector, const std::string & rsIndexName, const std::string & rsIndexSearchValue, glo::EnComparisionOp eComparisionOp ),
glo::TAllSet::getIndexedOndemands( std::vector< glo::TOndemand<T> > & rOndemandVector, const std::string & rsIndexName, unsigned long ulIndexClassID, const std::string & rsIndexSearchValue, glo::EnComparisionOp eComparisionOp ),
glo::TAllSet::getIndexedOndemands( std::vector< glo::TOndemand<T> > & rOndemandVector, const std::string & rsRangeStartIndex, const std::string & rsRangeEndIndex ),
glo::TAllSet::getIndexedOndemands( std::vector< glo::TOndemand<T> > & rOndemandVector, const std::string & rsIndexName, const std::string & rsRangeStartIndexSearchValue, const std::string & rsRangeEndIndexSearchValue ),

and
glo::TAllSet::getIndexedOndemands( std::vector< glo::TOndemand<T> > & rOndemandVector, const std::string & rsIndexName, unsigned long ulIndexClassID, const std::string & rsRangeStartIndexSearchValue, const std::string & rsRangeEndIndexSearchValue ).



Index declaration in the GlobalObjects schema

For interested parties only! Usually, the index declaration is made in the GloDevelloper, which adjusts the GlobalObjects schema accordingly.

To be able to search for objects via an index, an index section is required in the GlobalObjects schema. An index can consist of several attributes (for example, last name and first name).

An index in the GlobalObjects schema is always structured as follows: "ClassName.attributeName[20]|". If several attributes are to be used for a compound index, the index declaration looks like this, for example: "ClassName.attribute_1_name[20]|ClassName.attribute_2_name[15]|".

The class name must always be that of the class or superclass of the class to be indexed. The attribute name describes the attribute which is used in the index with the number of characters given in square brackets.

Since a class can also have, for example, embedded and otherwise referenced classes as an attribute, the attributes of these classes can also be used for indexing.

Note
For pointers and std::shared_ptr, the attributes are only considered when saving if they are included in the schema as dependent.

Such an index is always structured in this way:
"FirstClassName.FirstAttributeName.1_ClassName.1_AttributeName[20]|"

Note
A final '|' is mandatory.

The first class name must always be that of the class or superclass of the class to be indexed. The first attribute name is the attribute that specifies an embedded object, for example. The 1_ClassName is the class name of the embedded class or its superclass with its attribute 1_AttributeName, which is used in the index with the number of characters specified in square brackets.

This would also be possible (cascading): "FirstClassName.FirstAttributeName.1_ClassName.1_AttributeName.2_ClassNasme.2_AttributeName[20]|".

Thus, deeply nested classes can be indexed.

If more than one attribute is to be used as an index, the path to the next attribute is simply appended (terminated by a '|'). E.g.: "FirstClassName.FirstAttributName.1_ClassName.1_AttributName[20]|FirstClassName.SecondAttributName[10]|".

A commented example schema file can be viewed here.