Java Code Examples for org.apache.lucene.util.NumericUtils#intToPrefixCoded()

The following examples show how to use org.apache.lucene.util.NumericUtils#intToPrefixCoded() . 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: TermBuilder.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public BytesRef term(Float value) {
    int intValue = NumericUtils.floatToSortableInt(value);
    BytesRefBuilder bytesRef = new BytesRefBuilder();
    NumericUtils.intToPrefixCoded(intValue, 0, bytesRef);
    return bytesRef.get();
}
 
Example 2
Source File: FloatFieldMapper.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public BytesRef indexedValueForSearch(Object value) {
    int intValue = NumericUtils.floatToSortableInt(parseValue(value));
    BytesRefBuilder bytesRef = new BytesRefBuilder();
    NumericUtils.intToPrefixCoded(intValue, 0, bytesRef);   // 0 because of exact match
    return bytesRef.get();
}
 
Example 3
Source File: TermBuilder.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public BytesRef term(Integer value) {
    BytesRefBuilder builder = new BytesRefBuilder();
    NumericUtils.intToPrefixCoded(value, 0, builder);
    return builder.get();
}
 
Example 4
Source File: ShortFieldMapper.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public BytesRef indexedValueForSearch(Object value) {
    BytesRefBuilder bytesRef = new BytesRefBuilder();
    NumericUtils.intToPrefixCoded(parseValue(value), 0, bytesRef);  // 0 because of exact match
    return bytesRef.get();
}
 
Example 5
Source File: IntegerFieldMapper.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public BytesRef indexedValueForSearch(Object value) {
    BytesRefBuilder bytesRef = new BytesRefBuilder();
    NumericUtils.intToPrefixCoded(parseValue(value), 0, bytesRef); // 0 because of exact match
    return bytesRef.get();
}
 
Example 6
Source File: ByteFieldMapper.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public BytesRef indexedValueForSearch(Object value) {
    BytesRefBuilder bytesRef = new BytesRefBuilder();
    NumericUtils.intToPrefixCoded(parseValue(value), 0, bytesRef); // 0 because of exact match
    return bytesRef.get();
}
 
Example 7
Source File: BytesRefTermStream.java    From siren-join with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public BytesRef next() {
  BytesRefBuilder b = new BytesRefBuilder();
  NumericUtils.intToPrefixCoded((int) values.valueAt(this.count++), 0, b);
  return b.toBytesRef();
}