摘要: importorg.apache.lucene.analysis.standard.StandardAnalyzer;importorg.apache.lucene.document.Document;importorg.apache.lucene.document.Field;importorg.apache.lucene.index.CorruptIndexException;importorg.apache.lucene.index.IndexWriter;importorg.apache.lucene.queryParser.*;importorg.apache.lucene.sear 阅读全文
posted @ 2012-04-18 13:18 狼里格朗 阅读(1582) 评论(0) 推荐(0) 编辑
摘要: 1. 多个MUST的组合不必多说,就是交集2. MUST和SHOULD的组合。是在MUST搜出来的doc里面,根据SHOULD的query进行打分。也就是说,SHOULD的query不会影响最终的HITS,只会提供打分依据。3. SHOULD的组合。如果最终的BooleanQuery只有SHOULD,那么搜出来的doc至少要满足一个SHOULD的query,也就是说是逻辑OR。那么在下面这段代码中,问题就出现了:代码的本意是在baseQuery的基础上和geoQuery做一个交集public Map<String, Query> buildGeoQuery(Query baseQu 阅读全文
posted @ 2012-04-18 12:00 狼里格朗 阅读(5000) 评论(2) 推荐(2) 编辑
摘要: 删除索引 IndexWriter提供deleteDocuments(Term term); //会删除索引文件里含有指定Term的所有Document。 IndexReader也提供了deleteDocuments(Term term);8. 更新索引 IndexWriter提供updateDocument(Term term, Document doc); //实际上是先删除再创建索引。9. 常用查询器 1) TermQuery : 按Term(关键字)查询。构造方法:TermQuery(Term t) Query query = new TermQuery(new Term("c 阅读全文
posted @ 2012-04-18 11:51 狼里格朗 阅读(428) 评论(0) 推荐(0) 编辑