Lucene.Net Storing. How does it all come together?
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?
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.
精彩评论