我正在使用Solr版本6.2.1并尝试返回给定纬度和经度的最近位置。
我已设法将数据添加到Solr并将其编入索引。
我的数据文件(.CSV)采用以下格式:
id,areaname,geo,country,state
1125257,"Mumbai","18.9750,72.8258","India","Maharashtra"
1125258,"Mumgaon","26.3833,93.4833","India","Assam"
1125259,"Mummasar","28.2167,74.2833","India","Rajasthan"
1125260,"Mummidivaram","16.6500,82.1167","India","Andhra Pradesh"
1125261,"Munaba","25.7500,70.2833","India","Rajasthan"
1125262,"Munabao","25.7500,70.2833","India","Rajasthan"
1125263,"Munabo","25.7500,70.2833","India","Rajasthan"
1125264,"Munagala","17.0500,79.8333","India","Andhra Pradesh"
在托管架构文件下面设置以下字段:
<fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate"/>
和字段地理位置为:
<field name="geo" type="location" indexed="true" stored="true" />
<field name="geo_0_coordinate" type="tdouble" indexed="true" stored="false" />
<field name="geo_1_coordinate" type="tdouble" indexed="true" stored="false" />
现在,当我运行查询以找到最近的位置时,它在响应元素中没有返回任何内容。
{!geofilt sfield=geo}&pt=28.2167,74.2833&d=100
日志和数据中没有错误被编入索引。
请有人解释一下为什么这不起作用。
感谢。
答案 0 :(得分:0)
Solr将solr.LatLonType替换为solr.LatLonPointSpatialField 我刚刚使用LatLonPointSpatialField来解决这个问题。 没有必要使用拖车场_coordinate。