本文整理了Java中org.apache.lucene.document.DoubleDocValuesField.
方法的一些代码示例,展示了DoubleDocValuesField.
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DoubleDocValuesField.
方法的具体详情如下:
包路径:org.apache.lucene.document.DoubleDocValuesField
类名称:DoubleDocValuesField
方法名:
[英]Creates a new DocValues field with the specified 64-bit double value
[中]使用指定的64位双精度值创建新的DocValues字段
代码示例来源:origin: rnewson/couchdb-lucene
@Override
public void addFields(final String name, final Object value, final ViewSettings settings, final Document to) {
to.add(boost(new DoublePoint(name, toDouble(value)), settings));
to.add(new DoubleDocValuesField(name, toDouble(value)));
}
代码示例来源:origin: com.qwazr/qwazr-search
@Override
final protected void newField(final String fieldName, final Object value, final FieldConsumer consumer) {
final Field field;
if (value instanceof Number)
field = new DoubleDocValuesField(fieldName, ((Number) value).doubleValue());
else
field = new DoubleDocValuesField(fieldName, Double.parseDouble(value.toString()));
consumer.accept(genericFieldName, fieldName, field);
}
代码示例来源:origin: hibernate/hibernate-search
@Override
public void addNumericDocValuesFieldToDocument(String fieldName, Number numericValue, Document document) {
if ( numericValue == null ) {
throw new IllegalArgumentException( "the numericValue parameter shall not be null" );
}
if ( numericValue instanceof Double ) {
document.add( new DoubleDocValuesField( fieldName, ( (Double) numericValue ).doubleValue() ) );
}
else if ( numericValue instanceof Float ) {
document.add( new FloatDocValuesField( fieldName, ( (Float) numericValue ).floatValue() ) );
}
else if ( numericValue instanceof Integer ) {
document.add( new NumericDocValuesField( fieldName, ( (Integer) numericValue ).longValue() ) );
}
else if ( numericValue instanceof Long ) {
document.add( new NumericDocValuesField( fieldName, ( (Long) numericValue ).longValue() ) );
}
else {
throw new IllegalArgumentException( "unsupported type of Number" );
}
}
代码示例来源:origin: org.infinispan/infinispan-embedded-query
@Override
public void addNumericDocValuesFieldToDocument(String fieldName, Number numericValue, Document document) {
if ( numericValue == null ) {
throw new IllegalArgumentException( "the numericValue parameter shall not be null" );
}
if ( numericValue instanceof Double ) {
document.add( new DoubleDocValuesField( fieldName, ( (Double) numericValue ).doubleValue() ) );
}
else if ( numericValue instanceof Float ) {
document.add( new FloatDocValuesField( fieldName, ( (Float) numericValue ).floatValue() ) );
}
else if ( numericValue instanceof Integer ) {
document.add( new NumericDocValuesField( fieldName, ( (Integer) numericValue ).longValue() ) );
}
else if ( numericValue instanceof Long ) {
document.add( new NumericDocValuesField( fieldName, ( (Long) numericValue ).longValue() ) );
}
else {
throw new IllegalArgumentException( "unsupported type of Number" );
}
}
代码示例来源:origin: tuplejump/stargate-core
private static Field numericDocValuesField(String stripedName, final AbstractType abstractType, final ByteBuffer byteBufferValue) {
CQL3Type cqlType = abstractType.asCQL3Type();
if (cqlType == CQL3Type.Native.TIMESTAMP) {
Date date = (Date) abstractType.compose(byteBufferValue);
return new NumericDocValuesField(stripedName, date.getTime());
}
Number value = (Number) abstractType.compose(byteBufferValue);
if (cqlType == CQL3Type.Native.INT || cqlType == CQL3Type.Native.VARINT || cqlType == CQL3Type.Native.BIGINT || cqlType == CQL3Type.Native.COUNTER) {
return new NumericDocValuesField(stripedName, value.longValue());
} else if (cqlType == CQL3Type.Native.FLOAT) {
return new FloatDocValuesField(stripedName, value.floatValue());
} else if (cqlType == CQL3Type.Native.DECIMAL || cqlType == CQL3Type.Native.DOUBLE) {
return new DoubleDocValuesField(stripedName, value.doubleValue());
} else throw new IllegalArgumentException(String.format("Invalid type for numeric doc values <%s>", cqlType));
}
代码示例来源:origin: com.orientechnologies/orientdb-lucene
public static List
List
if (value instanceof Number) {
Number number = (Number) value;
if (value instanceof Long) {
fields.add(new NumericDocValuesField(fieldName, number.longValue()));
fields.add(new LongPoint(fieldName, number.longValue()));
return fields;
} else if (value instanceof Float) {
fields.add(new FloatDocValuesField(fieldName, number.floatValue()));
fields.add(new FloatPoint(fieldName, number.floatValue()));
return fields;
} else if (value instanceof Double) {
fields.add(new DoubleDocValuesField(fieldName, number.doubleValue()));
fields.add(new DoublePoint(fieldName, number.doubleValue()));
return fields;
}
fields.add(new NumericDocValuesField(fieldName, number.longValue()));
fields.add(new IntPoint(fieldName, number.intValue()));
return fields;
} else if (value instanceof Date) {
Date date = (Date) value;
fields.add(new NumericDocValuesField(fieldName, date.getTime()));
fields.add(new LongPoint(fieldName, date.getTime()));
return fields;
}
fields.add(new SortedDocValuesField(fieldName, new BytesRef(value.toString())));
fields.add(new TextField(fieldName, value.toString(), Field.Store.YES));
return fields;
}
代码示例来源:origin: com.sproutigy.libs.luceneplus/luceneplus-core
public static void add(@NonNull Document doc, @NonNull String name, java.lang.Double value, @NonNull FieldOptions options) {
if (value != null) {
if (options.isIndex()) {
if (LuceneVersionDetect.isLucene6()) {
doc.add(new DoublePoint(name, value));
} else {
doc.add(createLegacyLuceneField("org.apache.lucene.document.DoubleField", name, java.lang.Double.TYPE, value, options.isStore()));
}
}
if (options.isDocValue()) {
doc.add(new DoubleDocValuesField(name, value));
}
if (options.isStore() && (LuceneVersionDetect.isLucene6() || !options.isIndex())) {
doc.add(new StoredField(name, value));
}
}
}
代码示例来源:origin: dremio/dremio-oss
private void addToDoc(IndexKey key, Double value){
Preconditions.checkArgument(key.getValueType() == Double.class);
if(value == null){
return;
}
checkIfMultiValueField(key);
final String indexFieldName = key.getIndexFieldName();
doc.add(new DoublePoint(indexFieldName, value));
if (key.isStored()) {
doc.add(new StoredField(indexFieldName, value));
}
if (key.isSorted()) {
Preconditions.checkArgument(key.getSortedValueType() == SearchFieldSorting.FieldType.DOUBLE);
doc.add(new DoubleDocValuesField(indexFieldName, value));
}
}
代码示例来源:origin: javasoze/clue
doc.add(new DoubleDocValuesField("price", json.optDouble("price")));
doc.add(new TextField("contents", json.optString("contents"), Store.NO));
doc.add(new NumericDocValuesField("year", json.optInt("year")));
代码示例来源:origin: org.apache.lucene/lucene-spatial-extras
/** @see #createIndexableFields(org.locationtech.spatial4j.shape.Shape) */
public Field[] createIndexableFields(Point point) {
Field[] fields = new Field[fieldsLen];
int idx = -1;
if (hasStored) {
fields[++idx] = new StoredField(fieldNameX, point.getX());
fields[++idx] = new StoredField(fieldNameY, point.getY());
}
if (hasDocVals) {
fields[++idx] = new DoubleDocValuesField(fieldNameX, point.getX());
fields[++idx] = new DoubleDocValuesField(fieldNameY, point.getY());
}
if (hasPointVals) {
fields[++idx] = new DoublePoint(fieldNameX, point.getX());
fields[++idx] = new DoublePoint(fieldNameY, point.getY());
}
assert idx == fields.length - 1;
return fields;
}
代码示例来源:origin: weiboad/fiery
Field traceid = new StringField("traceid", getTraceid(), Field.Store.YES);
Field time = new DoubleDocValuesField("time", getTime());
Field timeDouble = new DoublePoint("time", getTime());
Field timeRaw = new StoredField("time_raw", getTime());
Field elapsed = new DoubleDocValuesField("elapsed_ms", getElapsed_ms());
Field elapsedRaw = new StoredField("elapsed_ms_raw", getElapsed_ms());
Field elapsedDouble = new DoublePoint("elapsed_ms", getElapsed_ms());
代码示例来源:origin: hibernate/hibernate-search
case DOUBLE:
if ( value instanceof Number ) {
facetField = new DoubleDocValuesField(
facetMetadata.getAbsoluteName(),
( (Number) value ).doubleValue()
代码示例来源:origin: org.apache.lucene/lucene-spatial-extras
private Field[] createIndexableFields(Rectangle bbox) {
Field[] fields = new Field[fieldsLen];
int idx = -1;
if (hasStored) {
fields[++idx] = new StoredField(field_minX, bbox.getMinX());
fields[++idx] = new StoredField(field_minY, bbox.getMinY());
fields[++idx] = new StoredField(field_maxX, bbox.getMaxX());
fields[++idx] = new StoredField(field_maxY, bbox.getMaxY());
}
if (hasDocVals) {
fields[++idx] = new DoubleDocValuesField(field_minX, bbox.getMinX());
fields[++idx] = new DoubleDocValuesField(field_minY, bbox.getMinY());
fields[++idx] = new DoubleDocValuesField(field_maxX, bbox.getMaxX());
fields[++idx] = new DoubleDocValuesField(field_maxY, bbox.getMaxY());
}
if (hasPointVals) {
fields[++idx] = new DoublePoint(field_minX, bbox.getMinX());
fields[++idx] = new DoublePoint(field_minY, bbox.getMinY());
fields[++idx] = new DoublePoint(field_maxX, bbox.getMaxX());
fields[++idx] = new DoublePoint(field_maxY, bbox.getMaxY());
}
if (xdlFieldType != null) {
fields[++idx] = new Field(field_xdl, bbox.getCrossesDateLine()?"T":"F", xdlFieldType);
}
assert idx == fields.length - 1;
return fields;
}
代码示例来源:origin: org.infinispan/infinispan-embedded-query
case DOUBLE:
if ( value instanceof Number ) {
facetField = new DoubleDocValuesField(
facetMetadata.getAbsoluteName(),
( (Number) value ).doubleValue()
代码示例来源:origin: apache/jackrabbit-oak
f = new NumericDocValuesField(name, FieldFactory.dateToLong(date));
} else if (tag == Type.DOUBLE.tag()) {
f = new DoubleDocValuesField(name, property.getValue(Type.DOUBLE));
} else if (tag == Type.BOOLEAN.tag()) {
f = new SortedDocValuesField(name,
代码示例来源:origin: org.apache.jackrabbit/oak-lucene
f = new NumericDocValuesField(name, FieldFactory.dateToLong(date));
} else if (tag == Type.DOUBLE.tag()) {
f = new DoubleDocValuesField(name, property.getValue(Type.DOUBLE));
} else if (tag == Type.BOOLEAN.tag()) {
f = new SortedDocValuesField(name,
代码示例来源:origin: org.infinispan/infinispan-embedded-query
document.add( new DoubleDocValuesField( sortField.getAbsoluteName(), (double) numericValue ) );
代码示例来源:origin: hibernate/hibernate-search
document.add( new DoubleDocValuesField( sortField.getAbsoluteName(), (double) numericValue ) );