private BitSet parseQuery ( FilterQuery filterQuery , DataSchema schema ) { BitSet queryBitSet = new BitSet ( ) ; if ( filterQuery instanceof MatchAllQuery || filterQuery . getFilterQueries ( ) . size ( ) < 1 ) return queryBitSet ; //facet drill down happens here for ( String filterField : filterQuery . getFilterQueries ( ) . keySet ( ) ) { final int columnIndex = schema . getColumnIndex ( filterField ) ; final Map < String , BitSet > map = fieldInvertedIndex . get ( columnIndex ) ; final FilterQuery . FilterQueryElement filterQueryElement = filterQuery . getFilterQueries ( ) . get ( filterField ) ; DataType type = schema . getType ( columnIndex ) ; switch ( type ) { case CoordinateLat : case CoordinateLon : case String : case Boolean : case Integer : // if range query if ( filterQueryElement instanceof FilterQuery . FilterFieldRange ) { queryBitSet = processRangeQueryIntegerTypes ( queryBitSet , map , filterQueryElement , type ) ; } else if ( filterQueryElement instanceof FilterQuery . FilterFieldGreaterThanInteger ) { queryBitSet = processIntegerGreaterThanDefaultTypes ( queryBitSet , map , filterQueryElement , type ) ; } else { // does most of the commons multi value types queryBitSet = processMultiValueQueryDefaultTypes ( queryBitSet , map , filterQueryElement , type ) ; } break ; case Date : if ( filterQueryElement instanceof FilterQuery . FilterFieldRangeDate ) { queryBitSet = processRangeQueryISODateTypes ( queryBitSet , map , filterQueryElement , type ) ; } else { queryBitSet = processRangeQueryMultiValueQueryDateYear ( queryBitSet , map , filterQueryElement , type ) ; } break ; case DateYear : // if range query if ( filterQueryElement instanceof FilterQuery . FilterFieldRange ) { queryBitSet = processRangeQueryDateYearType ( queryBitSet , map , filterQueryElement , type ) ; } else { queryBitSet = processRangeQueryMultiValueQueryDateYear ( queryBitSet , map , filterQueryElement , type ) ; } break ; } } return queryBitSet ; }
Calculates which documents are available given the current FilterQuery selection