【问题标题】:Unable to sort Solr Geospatial search results无法对 Solr 地理空间搜索结果进行排序
【发布时间】:2012-09-19 22:20:48
【问题描述】:

我们如何让 Solr 3.6.1 返回由bbox 过滤并按距离排序的地理空间搜索结果both

我尝试按照Solr docs 中的说明将&sort=geodist() asc 附加到URL,但出现错误:

sort param could not be parsed as a query, and is not a field that exists in the index: geodist()

使用排序和 bbox 查询 URL(不工作)

http://localhost8080/solr/select?wt=json&indent=true
&q=*:*
&fl=id,latlng
&fq={!bbox%20pt=42.352455,-71.048069%20sfield=latlng%20d=5}
&sort=geodist() asc

使用排序查询 URL(作品)

http://localhost:8080/solr/select?wt=json&indent=true
&fl=id,latlng
&q=*:*
&sfield=latlng
&pt=42.352455,-71.048069
&sort=geodist()%20asc

使用 bbox 查询 URL(作品)

http://localhost8080/solr/select?wt=json&indent=true
&q=*:*
&fl=id,latlng
&fq={!bbox%20pt=42.352455,-71.048069%20sfield=latlng%20d=5}

如何让bbox 过滤并按距离对结果进行排序 (geodist())?

【问题讨论】:

    标签: solr lucene gis geospatial solarium


    【解决方案1】:

    只需将您拥有的“pt”和“sfield”本地参数提取到顶级查询参数中,就像您对工作排序查询所做的那样。您的 fq 将只是 {!bbox d=5}

    【讨论】:

    • 是什么原因不得不把ptsfield参数去掉,却把d参数留在花括号里?
    • 所谓的“查询解析器”,如 bbox,首先在其 local-params 中查找参数,然后返回到顶部 URL 参数。它们需要位于顶层,以便 geodist() 可以看到它们。
    猜你喜欢
    • 2016-01-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-02
    相关资源
    最近更新 更多