当我需要在 lucence.net 索引中存储更多信息时,我需要做什么?
在 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该将标签添加到单独的标记化
tag
字段中。典型的查询如下所示:
前两个术语(
honda
和civic
)由用户输入,而后两个术语(red
) code> 和hatchback
)将从标签列表中选择。如果您想支持包含空格的标签,则必须通过子类化
CharTokenizer
来推出自己的标记器:Lucene.Net支持短语?:在索引过程中(原子地)标记字段中逗号分隔数据的最佳方法是什么?您可以为
tag
字段创建单独的索引,但您必须使用MultiSearcher
对单独的索引执行组合搜索。You should add your tags to a separate tokenised
tag
field.A typical query would look something like this:
The first two terms (
honda
andcivic
) are entered by the user, while the second two terms (red
andhatchback
) 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?You can create a separate index for your
tag
field, but you will have to use aMultiSearcher
to perform a combined search of the separated indexes.