现在我有一个字段位置:
Field:position
Type:location
Field-Type:org.apache.solr.schema.LatLonType
这个字段是在我的solr文档中用java创建的:
@Indexed(name = "position", type = "location")
private String position;
但是当我想这样的查询时:
&q=*:*&fq={!field f=position}Intersects(POLYGON((-10 30, -40 40, -10 -20, 40 20, 0 0, -10 30)))
不起作用,我认为问题出在我的position
字段类型上。
我如何解决这个问题?在我的java类中需要什么类型的类型?
错误是:
"error": {
"msg": "Can't parse point 'Intersects(POLYGON((-10 30, -40 40, -10 -20, 40 20, 0 0, -10 30)))' because: java.lang.NumberFormatException: For input string: \"Intersects(POLYGON((-10 30\"",
"code": 400
}
整个回应是:
{
"responseHeader": {
"status": 400,
"QTime": 2,
"params": {
"q": "*:*",
"indent": "true",
"fq": "{!field f=position}Intersects(POLYGON((-10 30, -40 40, -10 -20, 40 20, 0 0, -10 30)))",
"wt": "json",
"_": "1515490453401"
}
},
"error": {
"msg": "Can't parse point 'Intersects(POLYGON((-10 30, -40 40, -10 -20, 40 20, 0 0, -10 30)))' because: java.lang.NumberFormatException: For input string: \"Intersects(POLYGON((-10 30\"",
"code": 400
}
}
Solr版本为5.3.2并安装了JTS拓扑库。
答案 0 :(得分:0)
您是否在solr服务器中安装了库?
因为它的LGPL许可JTS拓扑库它不包含在solr发行版中。在solr帮助中,您可以获得下载和安装指南:Solr spatial search