热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.apache.lucene.document.DoubleDocValuesField.()方法的使用及代码示例

本文整理了Java中org.apache.lucene.document.DoubleDocValuesField.()方法的一些代码示例,展示了DoubleDocValuesField.()的具体用

本文整理了Java中org.apache.lucene.document.DoubleDocValuesField.()方法的一些代码示例,展示了DoubleDocValuesField.()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DoubleDocValuesField.()方法的具体详情如下:
包路径:org.apache.lucene.document.DoubleDocValuesField
类名称: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 createFields(String fieldName, Object value, Field.Store store /*,Field.Index index*/) {
List fields = new ArrayList<>();
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 ) );

推荐阅读
  • XML介绍与使用的概述及标签规则
    本文介绍了XML的基本概念和用途,包括XML的可扩展性和标签的自定义特性。同时还详细解释了XML标签的规则,包括标签的尖括号和合法标识符的组成,标签必须成对出现的原则以及特殊标签的使用方法。通过本文的阅读,读者可以对XML的基本知识有一个全面的了解。 ... [详细]
  • 本文主要解析了Open judge C16H问题中涉及到的Magical Balls的快速幂和逆元算法,并给出了问题的解析和解决方法。详细介绍了问题的背景和规则,并给出了相应的算法解析和实现步骤。通过本文的解析,读者可以更好地理解和解决Open judge C16H问题中的Magical Balls部分。 ... [详细]
  • 本文详细介绍了Spring的JdbcTemplate的使用方法,包括执行存储过程、存储函数的call()方法,执行任何SQL语句的execute()方法,单个更新和批量更新的update()和batchUpdate()方法,以及单查和列表查询的query()和queryForXXX()方法。提供了经过测试的API供使用。 ... [详细]
  • 第四章高阶函数(参数传递、高阶函数、lambda表达式)(python进阶)的讲解和应用
    本文主要讲解了第四章高阶函数(参数传递、高阶函数、lambda表达式)的相关知识,包括函数参数传递机制和赋值机制、引用传递的概念和应用、默认参数的定义和使用等内容。同时介绍了高阶函数和lambda表达式的概念,并给出了一些实例代码进行演示。对于想要进一步提升python编程能力的读者来说,本文将是一个不错的学习资料。 ... [详细]
  • This article discusses the efficiency of using char str[] and char *str and whether there is any reason to prefer one over the other. It explains the difference between the two and provides an example to illustrate their usage. ... [详细]
  • 如何自行分析定位SAP BSP错误
    The“BSPtag”Imentionedintheblogtitlemeansforexamplethetagchtmlb:configCelleratorbelowwhichi ... [详细]
  • 电话号码的字母组合解题思路和代码示例
    本文介绍了力扣题目《电话号码的字母组合》的解题思路和代码示例。通过使用哈希表和递归求解的方法,可以将给定的电话号码转换为对应的字母组合。详细的解题思路和代码示例可以帮助读者更好地理解和实现该题目。 ... [详细]
  • Iamtryingtomakeaclassthatwillreadatextfileofnamesintoanarray,thenreturnthatarra ... [详细]
  • 向QTextEdit拖放文件的方法及实现步骤
    本文介绍了在使用QTextEdit时如何实现拖放文件的功能,包括相关的方法和实现步骤。通过重写dragEnterEvent和dropEvent函数,并结合QMimeData和QUrl等类,可以轻松实现向QTextEdit拖放文件的功能。详细的代码实现和说明可以参考本文提供的示例代码。 ... [详细]
  • 本文讨论了一个关于cuowu类的问题,作者在使用cuowu类时遇到了错误提示和使用AdjustmentListener的问题。文章提供了16个解决方案,并给出了两个可能导致错误的原因。 ... [详细]
  • 本文介绍了一个在线急等问题解决方法,即如何统计数据库中某个字段下的所有数据,并将结果显示在文本框里。作者提到了自己是一个菜鸟,希望能够得到帮助。作者使用的是ACCESS数据库,并且给出了一个例子,希望得到的结果是560。作者还提到自己已经尝试了使用"select sum(字段2) from 表名"的语句,得到的结果是650,但不知道如何得到560。希望能够得到解决方案。 ... [详细]
  • CF:3D City Model(小思维)问题解析和代码实现
    本文通过解析CF:3D City Model问题,介绍了问题的背景和要求,并给出了相应的代码实现。该问题涉及到在一个矩形的网格上建造城市的情景,每个网格单元可以作为建筑的基础,建筑由多个立方体叠加而成。文章详细讲解了问题的解决思路,并给出了相应的代码实现供读者参考。 ... [详细]
  • 本文介绍了OpenStack的逻辑概念以及其构成简介,包括了软件开源项目、基础设施资源管理平台、三大核心组件等内容。同时还介绍了Horizon(UI模块)等相关信息。 ... [详细]
  • 本文由编程笔记#小编整理,主要介绍了关于数论相关的知识,包括数论的算法和百度百科的链接。文章还介绍了欧几里得算法、辗转相除法、gcd、lcm和扩展欧几里得算法的使用方法。此外,文章还提到了数论在求解不定方程、模线性方程和乘法逆元方面的应用。摘要长度:184字。 ... [详细]
  • 本文介绍了使用Python编写购物程序的实现步骤和代码示例。程序启动后,用户需要输入工资,并打印商品列表。用户可以根据商品编号选择购买商品,程序会检测余额是否充足,如果充足则直接扣款,否则提醒用户。用户可以随时退出程序,在退出时打印已购买商品的数量和余额。附带了完整的代码示例。 ... [详细]
author-avatar
Lora1201
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有