Example usage for org.apache.lucene.document DoublePoint newExactQuery

List of usage examples for org.apache.lucene.document DoublePoint newExactQuery

Introduction

In this page you can find the example usage for org.apache.lucene.document DoublePoint newExactQuery.

Prototype

public static Query newExactQuery(String field, double value) 

Source Link

Document

Create a query for matching an exact double value.

Usage

From source file:org.apache.solr.legacy.BBoxStrategy.java

License:Apache License

private Query makeNumberTermQuery(String field, double number) {
    if (hasPointVals) {
        return DoublePoint.newExactQuery(field, number);
    } else if (legacyNumericFieldType != null) {
        BytesRefBuilder bytes = new BytesRefBuilder();
        LegacyNumericUtils.longToPrefixCoded(NumericUtils.doubleToSortableLong(number), 0, bytes);
        return new TermQuery(new Term(field, bytes.get()));
    }/*from w  w w  . j av  a  2  s . c  om*/
    throw new UnsupportedOperationException("An index is required for this operation.");
}

From source file:org.apache.solr.schema.DoublePointField.java

License:Apache License

@Override
protected Query getExactQuery(SchemaField field, String externalVal) {
    return DoublePoint.newExactQuery(field.getName(), Double.parseDouble(externalVal));
}

From source file:org.janusgraph.diskstorage.lucene.NumericTranslationQueryParser.java

License:Apache License

private Query buildNumericQuery(final String field, final String value, Class<?> type) {
    if (AttributeUtil.isWholeNumber(type)) {
        if (isMatchAll(value)) {
            return LongPoint.newRangeQuery(field, Long.MIN_VALUE, Long.MAX_VALUE);
        } else {/*from   w w w .ja  va  2s  . c o m*/
            return LongPoint.newExactQuery(field, Long.parseLong(value));
        }
    } else {
        if (isMatchAll(value)) {
            return DoublePoint.newRangeQuery(field, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY);
        } else {
            return DoublePoint.newExactQuery(field, Double.parseDouble(value));
        }
    }
}