多值字段和标记化字段之间的评分差异

发布于 2024-12-25 08:06:35 字数 326 浏览 3 评论 0原文

例如,我每个文档有几个标签。我可以

  • 使用 WhiteSpaceTokenizer 将它们索引为按空格分割的单个文本字符串。 (例如“tag1 tag2 tag3”)
  • 使用 KeywordAnalyzer 将它们多次单独添加到单个字段名称( 示例<代码> doc.addField("tags1", "tag1"); doc.addField("标签", "标签2"); doc.addField("tags", "tag23) )

两种方法都有效。问题是这些类型的索引的评分有何不同? (即场归一化因子、tf/idf 计数、场长度计算、斜率因子等)

For example I have several tags per document. I can

  • index them as single text string spliting by space uisng WhiteSpaceTokenizer. (example "tag1 tag2 tag3")
  • add them separatly to single field name multiple times using KeywordAnalyzer (
    example
    doc.addField("tags1", "tag1");
    doc.addField("tags", "tag2");
    doc.addField("tags", "tag23)

    )

Both approaches will work. The question is how different will be scoring for those types of indexing? (i.e. field normalization factor, tf/idf count, field length calucaltion, slope factor etc)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

神也荒唐 2025-01-01 08:06:35

无论如何,Lucene 都会在幕后连接多值字段的所有值,因此它与您的第一种情况没有太大不同(如果有的话)。如果您仅使用标签作为过滤器(给我所有标有 tag2 的文档),那么您肯定不会看到任何差异。

Lucene will concatenate all the values for a multivalued filed behind the scene anyway, so it'd not be much different than your first case, if at all. If you use tags only as filters (give me all docs tagged with tag2), then you definitely won't see any difference.

热情消退 2025-01-01 08:06:35

我认为多值会更准确。

想象一下标记化字符串“spider webdeveloper”

值为“spider”和“webdeveloper”的多值字段,

搜索“webdeveloper”将匹配这两个字段,但匹配与多值字段可以被视为更多准确的。

I would think the multi-value would be more accurate.

imagine a tokenized string "spider web developer"

vs

multi-value field with the values "spider" and "web developer"

a search for "web developer" would match both fields but the match vs the multi-value field could be seen as more accurate.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文