我使用Solr 5.3.0并评估地理空间搜索。我按照在线参考的说明进行操作,并查看半径以外的结果。您是否在架构或数据中看到任何问题?
http://localhost:8983/solr/demo2/select?q=*.*&wt=json&indent=true&spatial=true&pt=4.89%2C-4.05&sfield=geoloc&d=1
<schema name="weather lookup index" version="1.3">
<types>
<fieldType name="integer" class="solr.TrieIntField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
<fieldtype name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>
<fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate"/>
<fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>
<fieldType name="text" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="true">
<analyzer type="index">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
</types>
<fields>
<field name="name" type="text" indexed="true" stored="true" multiValued="false" required="true"/>
<field name="geoloc" type="location" indexed="true" multiValued="false" stored="true"/>
<dynamicField name="*_coordinate" type="tdouble" indexed="true" stored="false"/>
</fields>
<defaultSearchField>name</defaultSearchField>
<solrQueryParser defaultOperator="OR"/>
</schema>
结果:
{
"responseHeader": {
"status": 0,
"QTime": 2,
"params": {
"q": ".",
"pt": "4.89,-4.05",
"d": "1",
"indent": "true",
"spatial": "true",
"sfield": "geoloc",
"wt": "json",
"": "1443653671468"
}
},
"response": {
"numFound": 1,
"start": 0,
"docs": [
{
"name": [ "test" ],
"geoloc": [ "40.89,-86.05" ],
"id": "9711c69e-9ac3-4302-a41d-719f57fde24c",
"_version": 1513779446777118700
}
]
}
}
答案 0 :(得分:0)
我相信您希望按照记录here为搜索添加过滤器。正如您现在所知,您正在定义参数,但不会过滤任何内容。
&fq={!geofilt pt=4.89,-4.05 sfield=geoloc d=1}
答案 1 :(得分:0)
看起来Solr并没有长期索引lat。 Solr在C:\ Program Files \ solr \ server \ solr \\ conf中创建一个名为managed_schema的文件,该文件覆盖我的schema.xml。我摆脱了managed_schema文件,它开始使用schema.xml(我必须在schema.xml中添加一些缺少的类型才能使它工作)。