【问题标题】:solr set relevancy score in solrconfigsolr 在 solrconfig 中设置相关性分数
【发布时间】:2017-03-07 16:54:02
【问题描述】:

我正在使用 solr 4.4,我想通过相关性搜索完全匹配的单词。我有 10 个字段,我使用了

复制字段来实现这一点。而且它工作正常。

我对完全匹配结果有疑问,应该是更高的顺序。

还有如何设置分数?

schema.xml

 <field name="field8" type="text_search" indexed="true" stored="true"/>
    <field name="description" type="text_search" indexed="true" stored="true"/>
   <field name="keywords" type="text_search" indexed="true" stored="true"/>


 <copyField source="field8" dest="text"/>
<copyField source="description" dest="text"/>
   <copyField source="keywords" dest="text"/>

solrconfig.xml

<requestHandler name="/browse" class="solr.SearchHandler">
     <lst name="defaults">
       <str name="echoParams">explicit</str>
<!-- Query settings -->
       <str name="defType">edismax</str>

        <str name="qf">
          field8 description keyword ^10.0
       </str> 
       <str name="df">text</str>
       <str name="mm">100%</str>
       <str name="q.alt">*:*</str>
       <str name="rows">10</str>
       <str name="fl">*,score</str>
     ........
      ........

    ........

【问题讨论】:

  • 请问有什么意见吗?
  • 对不起,请指点?

标签: solr


【解决方案1】:

短语字段 pf

一旦使用 fq 识别出匹配文档列表 和qf参数,pf参数可以用来“提升”分数 在 q 参数中的所有术语出现的情况下的文档 近在咫尺。

例如,如果您通过将 pf 设置为 title

来搜索 Apache Solr Lucene
q=Apache Solr Lucen
& qf=title name
& pf=title

<!--Debug-->

<str name="parsedquery_toString">
+((name:apache | title:apache) (name:solr | title:solr) (name:lucene | title:lucene)) (title:"apache solr lucene")
</str>

现在,如果您查看调试响应。它正在搜索单个关键字,但也将其作为短语进行搜索。所以它会提升所有以搜索字符串为短语的搜索结果。

P.S :- 同样 pf 只会影响提升分数而不是搜索结果。

【讨论】:

    猜你喜欢
    • 2015-06-14
    • 2014-02-15
    • 2014-10-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-22
    • 2016-11-04
    相关资源
    最近更新 更多