【问题标题】:Dismax Request HandlerDismax 请求处理程序
【发布时间】:2011-09-15 14:05:12
【问题描述】:

我正在使用 solr 按名称搜索一组数据(例如“Dan”或“Joe Smith”)。我想按照另一个索引字段 double_score(例如 10.0 或 72.3)指定的顺序返回查询指定的结果(编辑:末尾带有通配符)。我目前有以下根本无法工作:

<!-- Note that the default search is on the field name -->
<requestHandler name="/scoresearch" class="solr.SearchHandler" default="true">
   <!-- <lst name="invariants">
          <str name="q">{!boost b=sum(double_score) defType=dismax v=$qq}</str>
        </lst> -->
        <lst name="defaults">
          <str name="defType">dismax</str>    
          <str name="echoParams">explicit</str>
      <int name="rows">10</int>
     <!-- <str name="qq"></str> -->
      <str name="qf">double_score</str>
      <str name="debug">true</str>
      <str name="q.alt">*:*</str>
    </lst>
</requestHandler>

如果我删除了 cmets,那么搜索确实有效。我所做的任何查询都会被 q.alt 替换,然后被 double_score 的值提升。如果这没有取代 q.alt,这将是预期的效果。

另外请注意,虽然我还没有深入研究更有趣的可能性,例如标记名称,但我确实计划这样做。因此,任何可能的建议/解决方案都不应该排除这一点。

【问题讨论】:

  • 为什么是qf double_score?有“Dan”和“Joe Smith”的领域是什么?
  • double_score 是我想要确定的顺序。其他两个的字段是“名称”(默认搜索字段)

标签: solr dismax edismax


【解决方案1】:

我认为您过于复杂了...试试这个:

<lst name="defaults">
    <str name="defType">edismax</str>
    <str name="qf">name</str>
    <str name="q.alt">*:*</str>
    <str name="bf">double_score</str>
</lst>

【讨论】:

    【解决方案2】:

    试试

    http://localhost:8983/solr/select/?q=Joe Smith&qf=double_score^1.2 description
    

    意思是:

    1. 我在找乔·史密斯
    2. 我正在搜索字段 double-scoredescription

    description 将是您存储要搜索的文本的字段。

    确保 description 的数据类型为 text,带有

    stored="true" (in case you want to return snippets)
    indexed="true" (so it is searchable)
    

    文本数据类型使用过滤技术(词干提取、标记化),而字符串数据类型则按此方式处理。见How to determine field-type for SOLR indexing?

    【讨论】:

    • 所以我尝试这样做(已经将描述设置为文本)并发现它实际上并没有工作。在任何搜索成功之前,我必须输入搜索的全名。这意味着像“Dan”这样的东西只返回“Dan”而没有“Danielles”。 (我应该在原帖中指定“Dan*”,我很抱歉)。所以我然后尝试使用 edismax 并且确实有效,除了 qf 字段。您建议在这里做什么,使用 edismax 并弄清楚如何使用 qf 或实施与 dismax 相关的其他东西?再次感谢。
    • 搜索“Dan”时出现错误,不返回“Dan Brown”,不知道“Daniells”。也检查stackoverflow.com/questions/3208311/…(我自己检查过)。 Mauricio 的回答很有意义,设置了 bf(增强字段)。
    猜你喜欢
    • 1970-01-01
    • 2013-04-22
    • 1970-01-01
    • 1970-01-01
    • 2011-03-13
    • 2021-09-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多