Prerequisite: In order to understand content of this document please carefully read Indexing structure document beforefirst.
Requirements
Indexing structure has to provide fast and efficient way for querying the tree and retrieving the wanted objects.
...
- First the object is checked against the properties set directly in the index query objects (the same ones that were use to find the correct tree part).
- Only if this first check is passed, the object is check against all index query restrictions that are defined.
Index query restrictions
Index query restrictions are realized using reflection, meaning that each restriction is bounded to the one field of a class. This gives enough flexibility, so that every class and every field in that class can be tested. Different implementations of restrictions check if the passed object/value (which should be the value of the field defined in restriction) in method isFulfilled(Object o) has the correct value in relation the restriction value set in a restriction. Currently implemented restrictions, that are provided by IndexQueryRestrictionFactory, are:
- is Null
- is not Null
- equals
- not equals
- greater than
- greater or equals than
- less than
- less or equals than
Since reflection is relatively slow, it was concluded that major performance improvement would be to cache all methods that are invoked. Because of this, IIndexQueryRestirctionProcessor interface is defined, and IndexQuery is simply delegating the checking of all restrictions to the processor.
Need for aggregation
To fully simulate the database queering possibilities for memory storage, aggregation has to be develop in the future, with the set of basic aggregation functions as min, max, avg, sum, etc.