This is the 11th day of my participation in the August Gwen Challenge **

Lucene in doc. The add (new Field (” content “, curArt getContent (), Field. The Store. NO, Field. The Index. The TOKENIZED));

Field has two optional attributes: storage and index.

The store property allows you to control whether the Field is stored or not;

The index attribute allows you to control whether the Field is indexed or not.

In fact, it’s important to have the right combination of these two attributes.

Field.Index Field.Store indicates that TOKENIZED NO is indexed but stores NO YES this is not searchable, it’s just an adjuntion of what is being searched. UN_TOKENIZED YES/NO is not segmented, such as URL. It is searched as a whole, but not in part

The individual setting of these two attributes depends on whether the Field is indexed or stored, the size of the Field content, and the importance of the individual to its index.

Note: Under the same Document, indexes can be built for small fields to query fields whose content is too large and stored without indexing (set according to query requirements).

The summary is as follows:

1. If you want to find a Field, be sure to set field. Index to TOKENIZED or UN_TOKENIZED. TOKENIZED is used to participle the contents of Field; UN_TOKENIZED will not. The Field will be selected only if the whole word matches. 2. If field. Store is No, the value of the Field cannot be directly extracted from the index data in the search results, causing null.

Supplement:

Field.store. NO: not stored, storage has nothing to do with indexes Field.Store.COMPRESS: compressed storage, used for long text or binary, But performance is impaired by the analyzed_no_index indexes, but the values of the Field are not saved as normally, and only one byte is taken, This saves storage space by making indexes Field.Index.NOT_ANALYZED_NO_NORMS A byte holds the TermVector representing the entries in the Document (located by a Document and Field) and the number of times they occur in the current Document Field. Termvector. YES: Stores the TermVector Field for each Document Field.termvector. WITH_POSITIONS: storage position field.termvector. WITH_OFFSETS: storage offset Field.termvector. WITH_POSITIONS_OFFSETS: Storage location and offsetCopy the code

— — — — — — — —