Lucene.Net 存储。这一切是如何结合在一起的?

发布于 2024-10-10 01:25:11 字数 340 浏览 0 评论 0原文

我正在努力优化我的 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 技术交流群。

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

发布评论

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

评论(1

少年亿悲伤 2024-10-17 01:25:11

Field.Store 在此 SO 线程中得到了很好的解释 Lucene索引:存储和索引模式解释

基本上,搜索命中将包含设置了 Field.Store.YES 的所有字段的数据,如果您有其他存储机制,则不需要它就像数据库一样。如果您确实完全依赖 Lucene 来完成此任务,那么存储一些公共字段是有意义的,至少有一个允许您访问磁盘上的原始文档的字段。

Field.Store is explained beautifully in this SO thread Lucene indexing: Store and indexing modes explained

Basically 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.

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