Search in sources :

Example 16 with IndexOrDocValuesQuery

use of org.apache.lucene.search.IndexOrDocValuesQuery in project crate by crate.

the class LongEqQuery method rangeQuery.

@Override
public Query rangeQuery(String field, Long lowerTerm, Long upperTerm, boolean includeLower, boolean includeUpper) {
    long lower = lowerTerm == null ? Long.MIN_VALUE : (includeLower ? lowerTerm : lowerTerm + 1);
    long upper = upperTerm == null ? Long.MAX_VALUE : (includeUpper ? upperTerm : upperTerm - 1);
    Query indexQuery = LongPoint.newRangeQuery(field, lower, upper);
    return new IndexOrDocValuesQuery(indexQuery, SortedNumericDocValuesField.newSlowRangeQuery(field, lower, upper));
}
Also used : Query(org.apache.lucene.search.Query) IndexOrDocValuesQuery(org.apache.lucene.search.IndexOrDocValuesQuery) IndexOrDocValuesQuery(org.apache.lucene.search.IndexOrDocValuesQuery)

Aggregations

IndexOrDocValuesQuery (org.apache.lucene.search.IndexOrDocValuesQuery)16 Query (org.apache.lucene.search.Query)14 MatchNoDocsQuery (org.apache.lucene.search.MatchNoDocsQuery)6 PointRangeQuery (org.apache.lucene.search.PointRangeQuery)6 TermRangeQuery (org.apache.lucene.search.TermRangeQuery)5 IntPoint (org.apache.lucene.document.IntPoint)4 MappedFieldType (org.elasticsearch.index.mapper.MappedFieldType)4 QueryBuilders.rangeQuery (org.elasticsearch.index.query.QueryBuilders.rangeQuery)4 LongPoint (org.apache.lucene.document.LongPoint)3 Matchers.containsString (org.hamcrest.Matchers.containsString)3 FloatPoint (org.apache.lucene.document.FloatPoint)2 Version (org.elasticsearch.Version)2 Settings (org.elasticsearch.common.settings.Settings)2 IndexSettings (org.elasticsearch.index.IndexSettings)2 GeoPointFieldType (org.elasticsearch.index.mapper.GeoPointFieldMapper.GeoPointFieldType)2 QueryShardContext (org.elasticsearch.index.query.QueryShardContext)2 DoublePoint (org.apache.lucene.document.DoublePoint)1 HalfFloatPoint (org.apache.lucene.document.HalfFloatPoint)1 DirectoryReader (org.apache.lucene.index.DirectoryReader)1 IndexWriter (org.apache.lucene.index.IndexWriter)1