引用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.
本文详细介绍了LuceneInAction第二版2.4节中关于域索引选项(如ANALYZED、NOT_ANALYZED、ANALYZED_NO_NORMS等)和域存储选项(如YES、NO)的概念与应用,帮助理解如何通过这些选项控制文本字段的搜索和存储方式,特别强调了ANALYZED选项在实现精确匹配搜索中的作用,以及NOT_ANALYZED选项对于不希望被拆分字段的重要性。
1132

被折叠的 条评论
为什么被折叠?



