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.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值