开发者

Lucene: Can I run a query against few specific docs of the collection only?

Can I run a query against few 开发者_Python百科specific docs of the collection only ? Can I filter the built collection according to documents fields content ?

For example I would like to query over documents having field2 = "abc".

thanks


Sure -- use a Filter. See http://lucene.apache.org/java/3_0_1/api/core/org/apache/lucene/search/QueryWrapperFilter.html

The code will look something like:

QueryParser qp = ...
Filter filter = new QueryWrapperFilter(qp.parse("field2:abc"));
// pass filter to searcher.search()
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜