Lucene.Net 存储。这一切是如何结合在一起的?
我正在努力优化我的 Lucene 索引,但我有点不确定 Field.Store 的用途。想知道我是否可以获得合适的描述。
示例:
doc.Add(New Field("user", e.Username, Field.Store.YES, Field.Index.ANALYZED))
如果我的用户字段中存储了一个“用户”,并且我希望能够通过 user:joe
搜索该用户,我是否需要存储该字段 Field。商店。是
?我只是不太清楚这家商店是如何运作的。如果这意味着它不在索引中,那么将“user”字段放入索引中到底有什么意义呢?
I'm working on optimizing my Lucene index, and I'm a little unsure as to what the Field.Store is all about. Wondering if I could get a decent description.
Example:
doc.Add(New Field("user", e.Username, Field.Store.YES, Field.Index.ANALYZED))
If I've got a "user" stored in my user field, and I want to be able to search that user via user:joe
do I need to Store that field Field.Store.YES
? I'm just not quite sure how the store works. If it means that it's not in the index, then what would be the point of putting the "user" field in the index at all?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Field.Store
在此 SO 线程中得到了很好的解释 Lucene索引:存储和索引模式解释基本上,搜索命中将包含设置了
Field.Store.YES
的所有字段的数据,如果您有其他存储机制,则不需要它就像数据库一样。如果您确实完全依赖 Lucene 来完成此任务,那么存储一些公共字段是有意义的,至少有一个允许您访问磁盘上的原始文档的字段。Field.Store
is explained beautifully in this SO thread Lucene indexing: Store and indexing modes explainedBasically the search hits will include the data for all the fields with
Field.Store.YES
set, you don't need this if you have another storage mechanism like a DB. If you do rely on Lucene for this exclusively, it makes sens to store a few common fields, at least one that allows you to get to the original document on disk.