Lucene Field.Store.YES vs Field.Store.NO

Will someone explain under what circumstances can I use Field.Store.NO instead of Field.Store.YES ? I am extremely new to Lucene. And I'm trying to create a document. According to my basic knowledge, I do

 doc.add(new StringField(fieldNameA,fieldValueA,Field.Store.YES)); doc.add(new TextField(fieldNameB,fieldValueB,Field.Store.YES)); 
+5
source share
1 answer

There are two main ways to write a document to Lucene.

  • Indexed — The field is parsed and indexed and can be searched.
  • Saved - the full text of the field is saved and will be returned with the search results.

If the document is indexed but not saved, you can search for it, but it will not be returned with the search results.

One common pattern is to use lucene to search, but only to store an identification field that can be used to retrieve the full contents of a document / record from, for example, an SQL database, file system, or web resource.

You can also refuse to save the field if this field is a search tool, but you do not display it to the user, for example soundex / metaphone, or an alternative analysis of the content field.

+10
source

Source: https://habr.com/ru/post/1232925/


All Articles