Lucene的Field选项解释

引用Lucene In Action第二版2.4节内容:

域索引选项:

The options for indexing (Field.Index.* ) control how the text in the field will be

made searchable via the inverted index. Here are the choices:


  • ƒ Index.ANALYZED—Use the analyzer to break the field’s value into a stream of separate tokens and make each token searchable. This option is useful for normal text fields (body, title, abstract, etc.).
  • ƒ Index.NOT_ANALYZED —Do index the field, but don’t analyze the String value. Instead, treat the  Field ’s entire value as a single  token and make that token searchable. This option is useful for fiel ds that you’d like to search on but that shouldn’t be broken up, such as URLs, file system paths, dates, personal names, Social Security numbers, and telephone nu mbers. This option is especially useful for enabling “exact match精确匹配” searching. We indexed the id field in listings 2.1 and 2.3 using this option.
  • ƒ Index.ANALYZED_NO_NORMS —A variant of  Index.ANALYZED that doesn’t store norms information in the index. Norms record index-time boost information in the index but can be memory consuming when you’re searching. Section 2.5.3 describes norms in detail.
  • ƒ Index.NOT_ANALYZED_NO_NORMS—Just like  Index.NOT_ANALYZED , but also doesn’t store norms. This option is frequently used to save index space and memory usage during searching, because single-token fields don’t need the norms information un less they’re boosted.
  • ƒ Index.NO —Don’t make this field’s value available for searching. 

域存储选项:

The options for stored fields ( Field.Store.* ) determine whether the field’s exact

value should be stored away so that you can later retrieve it during searching:


  • ƒ Store.YES—Stores the value. When the value is stored, the original  String in its entirety is recorded in the index and may be retrieved by an  IndexReader. This option is useful for fields that you’d like to use when displaying the search results (such as a  URL, title, or database primary key). Try not to store very large fields, if index size is a concern, as stored fields consume space in the index.
  • ƒ Store.NO —Doesn’t store the value. This  option is often used along with Index.ANALYZED to index a large text field that doesn’t need to be retrieved in its original form, such as bodies of web pages, or any other type of text document.

猜你喜欢

转载自wujay.iteye.com/blog/1528725