【问题标题】:Lucene - proximity to start of field text?Lucene - 接近字段文本的开头?
【发布时间】:2014-11-05 10:46:00
【问题描述】:

我有一个搜索字段“标题”,在其中,我想说“与标题开头匹配的内容应该在搜索结果中得分更高”。

例如

Title: "The quick brown fox jumps over the lazy dog"
Title: "the lazy dogs were under the jumping quick brown fox"
Title: "The lazy brown fox jumps over the quick dog"
Title: "The brown fox made quick jumps over the sleazy dog"

如果我搜索“快速”,我希望第一个结果排名第一,第四个结果排名第二。

这在 lucene 中可能吗?如果有任何区别,我正在使用 Lucene.NET / Version_29。

【问题讨论】:

    标签: search lucene lucene.net information-retrieval


    【解决方案1】:

    在编制索引期间,您可以将其第一次出现的位置与每个术语一起存储在相应术语的有效负载中。在检索过程中,您可以使用修改后的相似度函数,在该函数中,除了术语权重之外,您还可以考虑存储的术语位置。

    一个相关的 SO 问题是here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-19
      相关资源
      最近更新 更多