org.apache.lucene.index.FilteredTermsEnum Java Examples

The following examples show how to use org.apache.lucene.index.FilteredTermsEnum. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OrdinalsBuilder.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
/**
 * A {@link TermsEnum} that iterates only highest resolution geo prefix coded terms.
 *
 * @see #buildFromTerms(TermsEnum)
 */
public static TermsEnum wrapGeoPointTerms(TermsEnum termsEnum) {
    return new FilteredTermsEnum(termsEnum, false) {
        @Override
        protected AcceptStatus accept(BytesRef term) throws IOException {
            // accept only the max resolution terms
            // todo is this necessary?
            return GeoEncodingUtils.getPrefixCodedShift(term) == GeoPointField.PRECISION_STEP * 4 ?
                AcceptStatus.YES : AcceptStatus.END;
        }
    };
}
 
Example #2
Source File: OrdinalsBuilder.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
/**
 * A {@link TermsEnum} that iterates only full precision prefix coded 64 bit values.
 *
 * @see #buildFromTerms(TermsEnum)
 */
public static TermsEnum wrapNumeric64Bit(TermsEnum termsEnum) {
    return new FilteredTermsEnum(termsEnum, false) {
        @Override
        protected AcceptStatus accept(BytesRef term) throws IOException {
            // we stop accepting terms once we moved across the prefix codec terms - redundant values!
            return NumericUtils.getPrefixCodedLongShift(term) == 0 ? AcceptStatus.YES : AcceptStatus.END;
        }
    };
}
 
Example #3
Source File: OrdinalsBuilder.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
/**
 * A {@link TermsEnum} that iterates only full precision prefix coded 32 bit values.
 *
 * @see #buildFromTerms(TermsEnum)
 */
public static TermsEnum wrapNumeric32Bit(TermsEnum termsEnum) {
    return new FilteredTermsEnum(termsEnum, false) {

        @Override
        protected AcceptStatus accept(BytesRef term) throws IOException {
            // we stop accepting terms once we moved across the prefix codec terms - redundant values!
            return NumericUtils.getPrefixCodedIntShift(term) == 0 ? AcceptStatus.YES : AcceptStatus.END;
        }
    };
}
 
Example #4
Source File: CrateRegexQuery.java    From crate with Apache License 2.0 4 votes vote down vote up
@Override
protected FilteredTermsEnum getTermsEnum(Terms terms, AttributeSource atts) throws IOException {
    return new CrateRegexTermsEnum(terms.iterator(), term, flags);
}