【问题标题】:sentence similarity in Apache solrApache solr 中的句子相似度
【发布时间】:2019-03-28 07:13:59
【问题描述】:

我正在使用 Solr 来匹配短语。

索引数据:

id:1
keyword:"simple  text|text with simple word |simple word text"
group:group1

id:2
keyword:"complex word| words with adjectives| text with adjective"
group:group2 

我已经索引了由管道分隔的短语,属于 1 组

查询:

"Document with simple text"

当我使用上述查询进行搜索时,我的搜索结果应该是

id:1
keyword:"simple  text
Group: Group1

因为

查询包含上述短语中的所有单词 即:“简单”和“文本”

谁能告诉我如何在 solr 中做到这一点?

【问题讨论】:

    标签: search solr sentence-similarity


    【解决方案1】:

    在搜索词之间使用布尔或运算符:

     Document OR with OR simple OR text
    

    这不会保证命中词的顺序,但允许部分匹配。

    如果您使用 DisMax 查询解析器,您还可以指定要匹配的术语比率的最小下限(例如,您总是希望至少 50% 的术语匹配)。使用mm的参数:https://lucene.apache.org/solr/guide/6_6/the-dismax-query-parser.html#TheDisMaxQueryParser-Themm_MinimumShouldMatch_Parameter

    顺便说一句,keyword 字段中管道 (|) 概念的用途尚不清楚。您是否打算将值存储在数组中?为此使用字段上的multiValued=true 设置并单独存储每个值。

    【讨论】:

      猜你喜欢
      • 2015-03-25
      • 2017-01-10
      • 2020-12-27
      • 2015-07-04
      • 1970-01-01
      • 2011-05-01
      • 1970-01-01
      • 2016-07-09
      • 2011-01-03
      相关资源
      最近更新 更多