目标是按分数然后距离执行多重排序,并将半径限制为 0.14 度,我执行以下查询:
localhost:8983/solr/coll1/select?sortsq={! score=distance}locations:"Intersects(Circle(34.0031792,-118.3082034 d=0.14))"&fl=score,distdeg:query($sortsq),*&facet=true&sort=score desc,query($sortsq) asc&indent=on&wt=xml&version=2.2&rows=10&start=0&q=text:*&facet.field=xxxxx&fq=fieldname:"filterValue"
返回所有匹配查询的文档,无论是否在圆圈内,但0.14度以内的返回距离(distdeg),其他不返回该字段。
如何省略不相交的文档?
位置字段声明:
<fieldType name="geo_field" class="solr.SpatialRecursivePrefixTreeFieldType"
spatialContextFactory="com.spatial4j.core.context.jts.JtsSpatialContextFactory"
distErrPct="0.025"
maxDistErr="0.000009"
units="degrees"
/>
更新: 查询的工作版本
http://localhost:8983/solr/coll1/select?getDist={! score=distance}locations:"Intersects(Circle(34.0031792,-118.3082034 d=0.14))"&fl=score,distdeg:query($getDist),*&facet=true&sort=score desc&indent=on&wt=xml&version=2.2&rows=10&start=0&q=*:*&boost=query({! score=distdeg filter=false v=$getDist)&fq=locations:"Intersects(Circle(34.0031792,-118.3082034 d=0.14))",states:"CA"