1. IndexWriter.flush();
2. 替换为
3. IndexWriter.commit();
4.org.apache.lucene.search.Hits;
这个类将在 3.0 中被删除
新的使用方法在上面的例子中
5.Field 的创建
Java 代码
1. 在 2.0+中
2. Field 没了 Keyword、UnIndexed、UnStored、Text 这几个静态成员,只能用
3. Field(String, String, Store, Index)。
4. Keyword 对应 Field.Store.YES, Field.Index.UN_TOKENIZED,
5. UnIndexed 对应 Field.Store.YES, Field.Index.NO,
6. UnStored 对应 Field.Store.NO, Field.Index.TOKENIZED,
7. Text 对应 Field.Store.YES, Field.Index.TOKENIZED
8. //2.0 版本以上
9. Field(String name, byte[] value, Field.Store store)
10. // Create a stored field with binary value.
11.Field(String name, Reader reader)
12. // Create a tokenized and indexed field that is not s
tored.
13.Field(String name, Reader reader, Field.TermVector termVector)
14. // Create a tokenized and indexed field that is not s
tored, optionally with storing term vectors.
15.Field(String name, String value, Field.Store store, Field.Index
index)
16. // Create a field by specifying its name, value and h
ow it will be saved in the index.
17.Field(String name, String value, Field.Store store, Field.Index
index, Field.TermVector termVector)
18. // Create a field by specifying its name, value and h
ow it will be saved in the index.
Field.Store 表示“是否存储”,即该 Field 内的信息是否要被原封不动的保
存在索引中。