当我需要在 lucence.net 索引中存储更多信息时,我需要做什么?

发布于 2024-10-26 08:21:48 字数 213 浏览 12 评论 0原文

在 Lucene 中,我需要添加一些有关帖子搜索的信息。为了进行更好的搜索,我想添加标签名称或一些其他信息以进行更好的搜索。每当我有两个可能的选项来解决这个问题时,我会选择什么选项。

将标签附加到我帖子的内容或摘录中。

或者创建一个新的索引来解决同样的难题。

好吧,我需要知道如果我将它们附加到现有索引中或在 lucene 中创建新索引来存储另一种信息有什么不同。

In Lucene I need to add some information about the post for search. For make a better search I thing to add the tags name or some other information to make a bettter search. What option I choose whenever I have two possible option for solve this problem.

Append the tags into the content or excerpt of the post I have.

Or make a new index to solve the same puzzle.

Well I need to know what is different if I append them in existing index or make a new index in lucene to store an another kind of information.

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

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

发布评论

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

评论(1

酒中人 2024-11-02 08:21:48

您应该将标签添加到单独的标记化 tag 字段中。

典型的查询如下所示:

content:(+honda +civic) +tag:red +tag:hatchback

前两个术语(hondacivic)由用户输入,而后两个术语(red) code> 和 hatchback)将从标签列表中选择。

如果您想支持包含空格的标签,则必须通过子类化 CharTokenizer 来推出自己的标记器:Lucene.Net支持短语?:在索引过程中(原子地)标记字段中逗号分隔数据的最佳方法是什么?

+tag:"5 door"

您可以为 tag 字段创建单独的索引,但您必须使用MultiSearcher 对单独的索引执行组合搜索。

You should add your tags to a separate tokenised tag field.

A typical query would look something like this:

content:(+honda +civic) +tag:red +tag:hatchback

The first two terms (honda and civic) are entered by the user, while the second two terms (red and hatchback) would be selected from a list of tags.

If you want to support tags that contain spaces, you will have to roll your own tokeniser by subclassing CharTokenizer: Lucene.Net support phrases?: What is best approach to tokenize comma-delimited data (atomically) in fields during indexing?

+tag:"5 door"

You can create a separate index for your tag field, but you will have to use a MultiSearcher to perform a combined search of the separated indexes.

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