【问题标题】:Using a function query from Solr使用 Solr 的函数查询
【发布时间】:2013-08-20 15:41:56
【问题描述】:

我正在尝试计算索引中某个术语的 tf*idf。
http://yonik.com/posts/solr-relevancy-function-queries/ 发来 Yonik 的帖子之后,我尝试了
http://localhost:8080/solr/select/?fl=score,id&defType=func&q=mul(tf(texto_completo,bug),idf(texto,bug)) (其中 texto_completo 是字段,'bug' 是术语)没有多大成功。回复是:

错误 400:客户端发送的请求在语法上不正确(null)。

我继续看这个答案 /a/13477887 所以我尝试做一个更简单的函数查询:

http://localhost:8080/solr/select/?q={!func}docFreq(texto_completo,bug)  

然而,我得到了同样的错误。
我的语法缺少什么才能正常工作?

【问题讨论】:

    标签: ajax rest solr indexing


    【解决方案1】:

    这不起作用:

    q={!func}docFreq(texto_completo,bug)
    

    全部使用小写docfreq:

    q={!func}docfreq(texto_completo,bug)
    

    我刚试过:

    q={!func}mul(tf(name,movie),idf(name,movie))
    

    在 Solr 4.2.1 中,它工作正常。我的字段名称是name(文本类型),我要查找的术语是movie

    更新:您至少需要 Solr 4.0 才能使用这些。见http://wiki.apache.org/solr/FunctionQuery#Relevance_Functions

    【讨论】:

    • 我使用的是 Solr 3.6,这有什么不同吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-16
    • 1970-01-01
    • 1970-01-01
    • 2017-03-26
    相关资源
    最近更新 更多