lcene中设置Boots问题,急啊
我给document.setBoost(11.0f);
当我取d.getBoost()的时候直变成了1.0
请问这是为什么
public static void main(String[] args) {
try {
System.out.println("开始");
IndexWriter indexWriter = new IndexWriter("index", new StandardAnalyzer(), true);
Document document = new Document();
Field FieldPath = new Field("path", "你好", Field.Store.YES, Field.Index.UN_TOKENIZED);
Field FieldBody = new Field("body", "中国", Field.Store.YES,Field.Index.UN_TOKENIZED);
document.add(FieldPath);
document.add(FieldBody);
document.setBoost(11.0f);//设置值
indexWriter.addDocument(document);
indexWriter.close();
IndexReader reader = IndexReader.open("index");
System.out.println("共有到"+reader.numDocs()+"条 ");
for (int i = 0; i < reader.numDocs(); i++)
{
Document d = reader.document(i);
System.out.println(d.getBoost());//取得直
}
System.out.println("结束");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}