Java Code Examples for org.apache.lucene.util.NumericUtils#longToPrefixCoded()
The following examples show how to use
org.apache.lucene.util.NumericUtils#longToPrefixCoded() .
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: QueryBuilderHelper.java From Elasticsearch with Apache License 2.0 | 6 votes |
private BytesRef valueForSearch(Object value) { if (value == null) return null; BytesRefBuilder bytesRef = new BytesRefBuilder(); NumericUtils.longToPrefixCoded(parseValue(value), 0, bytesRef); // 0 because of exact match return bytesRef.get(); }
Example 2
Source File: TermBuilder.java From Elasticsearch with Apache License 2.0 | 6 votes |
@Override public BytesRef term(Long value) { BytesRefBuilder builder = new BytesRefBuilder(); NumericUtils.longToPrefixCoded(value, 0, builder); return builder.get(); }
Example 3
Source File: IpFieldMapper.java From Elasticsearch with Apache License 2.0 | 6 votes |
@Override public BytesRef indexedValueForSearch(Object value) { BytesRefBuilder bytesRef = new BytesRefBuilder(); NumericUtils.longToPrefixCoded(parseValue(value), 0, bytesRef); // 0 because of exact match return bytesRef.get(); }
Example 4
Source File: DateFieldMapper.java From Elasticsearch with Apache License 2.0 | 6 votes |
@Override public BytesRef indexedValueForSearch(Object value) { BytesRefBuilder bytesRef = new BytesRefBuilder(); NumericUtils.longToPrefixCoded(parseValue(value), 0, bytesRef); // 0 because of exact match return bytesRef.get(); }
Example 5
Source File: LongFieldMapper.java From Elasticsearch with Apache License 2.0 | 6 votes |
@Override public BytesRef indexedValueForSearch(Object value) { BytesRefBuilder bytesRef = new BytesRefBuilder(); NumericUtils.longToPrefixCoded(parseLongValue(value), 0, bytesRef); // 0 because of exact match return bytesRef.get(); }
Example 6
Source File: BytesRefTermStream.java From siren-join with GNU Affero General Public License v3.0 | 6 votes |
@Override public BytesRef next() { BytesRefBuilder b = new BytesRefBuilder(); NumericUtils.longToPrefixCoded((int) values.valueAt(this.count++), 0, b); return b.toBytesRef(); }
Example 7
Source File: DocumentBuilder.java From modernmt with Apache License 2.0 | 6 votes |
private static Term makeLongTerm(long value, String field) { BytesRefBuilder builder = new BytesRefBuilder(); NumericUtils.longToPrefixCoded(value, 0, builder); return new Term(field, builder.toBytesRef()); }
Example 8
Source File: DefaultDocumentBuilder.java From modernmt with Apache License 2.0 | 6 votes |
private static Term makeLongTerm(long value, String field) { BytesRefBuilder builder = new BytesRefBuilder(); NumericUtils.longToPrefixCoded(value, 0, builder); return new Term(field, builder.toBytesRef()); }
Example 9
Source File: TermBuilder.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Override public BytesRef term(Double value) { long longValue = NumericUtils.doubleToSortableLong(value); BytesRefBuilder bytesRef = new BytesRefBuilder(); NumericUtils.longToPrefixCoded(longValue, 0, bytesRef); return bytesRef.get(); }
Example 10
Source File: DoubleFieldMapper.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Override public BytesRef indexedValueForSearch(Object value) { long longValue = NumericUtils.doubleToSortableLong(parseDoubleValue(value)); BytesRefBuilder bytesRef = new BytesRefBuilder(); NumericUtils.longToPrefixCoded(longValue, 0, bytesRef); // 0 because of exact match return bytesRef.get(); }
Example 11
Source File: TermsEnumTermsQueryTest.java From siren-join with GNU Affero General Public License v3.0 | 5 votes |
/** * Converts a list of long value to their bytes ref representation as performed by * {@link org.apache.lucene.analysis.NumericTokenStream} */ private BytesRef[] toBytesRefs(long[] values) { BytesRef[] bytesRefs = new BytesRef[values.length]; for (int i = 0; i < values.length; i++) { BytesRefBuilder b = new BytesRefBuilder(); NumericUtils.longToPrefixCoded(values[i], 0, b); bytesRefs[i] = b.toBytesRef(); } return bytesRefs; }
Example 12
Source File: MoneyTools.java From Lottery with GNU General Public License v2.0 | 4 votes |
/** * 将money*1000,转换成long,再转换成string。 * * @param money * @return * @see NumberTools#longToString(long) */ public static String moneyToString(BigDecimal money) { Assert.notNull(money); return NumericUtils.longToPrefixCoded(money.multiply(MULTIPLE) .longValue()); }