gpt4 book ai didi

solr - 如何通过 geodist() 的逆来提高 Solr 相关性分数

转载 作者:行者123 更新时间:2023-12-01 23:20:31 24 4
gpt4 key购买 nike

所以我已经实现并成功使用了 Solr 4。我不得不说 Solr 4 太棒了!不管怎样,我成功地按距离排序,并使用地理过滤器将结果限制在某个区域。我现在想做的是通过距离的倒数来提高相关性分数。本页讨论了它,但没有说明如何操作 (http://wiki.apache.org/solr/SpatialSearch)

我已尝试以下操作,但出现错误:

http://localhost:8983/solr/select/?q={!boost b=recip(geodist(), 1, 1000, 1000)}...

我得到的错误是:

org.apache.lucene.queryParser.ParseException: pos 27 str='{!boost b=recip(geodist(), 1, 10 in ... 中的预期标识符

如有任何帮助,我们将不胜感激。谢谢!

最佳答案

您仍然需要在 boost 函数之后指定查询的主要部分:

q={!boost b=recip(geodist(),1,1000,1000)}foo:bar&...

如果您只对距离的倒数提升感兴趣,则可以使用通配符查询:

q={!boost b=recip(geodist(),1,1000,1000)}*&...

...或使用函数查询解析器:

q={!func}recip(geodist(),1,1000,1000)&...

您还需要指定纬度/经度值和空间字段以作为 geodist 函数的参数进行查询:

q={!boost b=recip(geodist(50.1, -0.86, myGeoField),1,1000,1000)}foo:bar&...

...或分解为查​​询字符串参数:

q={!boost b=recip(geodist(),1,1000,1000)}foo:bar&sfield=myGeoField&pt=50.1,-0.86

关于solr - 如何通过 geodist() 的逆来提高 Solr 相关性分数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4702519/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com