public List < OIndexSearchResult > analyzeCondition ( OSQLFilterCondition condition , final OClass schemaClass , OCommandContext context ) { final List < OIndexSearchResult > indexSearchResults = new ArrayList < OIndexSearchResult > ( ) ; OIndexSearchResult lastCondition = analyzeFilterBranch ( schemaClass , condition , indexSearchResults , context ) ; if ( indexSearchResults . isEmpty ( ) && lastCondition != null ) { indexSearchResults . add ( lastCondition ) ; } Collections . sort ( indexSearchResults , new Comparator < OIndexSearchResult > ( ) { public int compare ( final OIndexSearchResult searchResultOne , final OIndexSearchResult searchResultTwo ) { return searchResultTwo . getFieldCount ( ) - searchResultOne . getFieldCount ( ) ; } } ) ; return indexSearchResults ; }
Analyzes a query filter for a possible indexation options . The results are sorted by amount of fields . So the most specific items go first .