Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/326.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java NumericRangeQuery的SOLR空间使用_Java_Solr_Lucene - Fatal编程技术网

Java NumericRangeQuery的SOLR空间使用

Java NumericRangeQuery的SOLR空间使用,java,solr,lucene,Java,Solr,Lucene,我在读下面的一篇文章 一种空间过滤器,它使用基于NumericRangeQuery的边界框轻松过滤出特定范围之外的文档 稍微调查一下,我看不到SOLR源代码中实际发生了这种情况: 即,在第201行,我看到: Query latRange = latField.getType().getRangeQuery(parser, latField, String.valueOf(latMin),String.valueOf(latMax),true, true); 它似乎使用了一个TermR

我在读下面的一篇文章

一种空间过滤器,它使用基于NumericRangeQuery的边界框轻松过滤出特定范围之外的文档

稍微调查一下,我看不到SOLR源代码中实际发生了这种情况:

即,在第201行,我看到:

Query latRange = latField.getType().getRangeQuery(parser, latField,
    String.valueOf(latMin),String.valueOf(latMax),true, true);
它似乎使用了一个TermRangeQuery。这里转到NumericRangeQuery javadoc,NumericRangeQuery显然更可取,因为它要快得多:


将索引上的不同类型的RangeQuery与大约500000个文档进行比较,结果表明布尔重写模式下的TermRangeQuery(使用提升的BooleanQuery子句计数)需要30-40秒才能完成,恒定分数过滤器重写模式下的TermRangeQuery需要5秒,而执行此类实际上需要,
bbox
geofilt
空间过滤器将使用
createSpatialQuery
,而默认(Lucene)查询解析器(使用语法
[start TO end]
)将使用
getRangeQuery

在这两种情况下,这些方法都利用子字段上的
getRangeQuery
。范围查询的类型取决于此子字段类型,可使用LatLon字段类型的
subFieldType
subFieldSuffix
属性配置此子字段类型。如果要使用数值范围查询,只需使用
triedublefield
的实例即可

比如说

<fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>
<fieldType name="latLon" class="solr.LatLonType" subFieldSuffix="_latLon"/>
<field name="lat_lon" type="latLon" indexed="true" stored="true"/>
<dynamicField name="*_latLon" type="tdouble" indexed="true" stored="false" multiValued="true"/>


能否粘贴LatLon字段的定义?谢谢。我还添加了一个示例。如果您使用默认配置,那么您可能已经在使用NumericRangeQuery。因此,您的意思是,如果_坐标的动态类型为tdouble,那么它将使用NumericRangeQuery?确切地说。
<fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>
<fieldType name="latLon" class="solr.LatLonType" subFieldSuffix="_latLon"/>
<field name="lat_lon" type="latLon" indexed="true" stored="true"/>
<dynamicField name="*_latLon" type="tdouble" indexed="true" stored="false" multiValued="true"/>