开发者

How to have more than 100 results?

My question is simple but I can't find the answer. Is there a way to set in Lucene to retrieve an amount of results higher than 100 in a query? Im using lucene 2.4.0 now开发者_如何学C.

Thanks all.


Functionality for controlling the search result size and itarations over larger search results has been vastly improved in later versions of Lucene. If you have the possibility, consider upgrading to 2.9 or even 3.0.

That being said, I cannot from your post determine how exactly you get your search results returned. Perhaps you use a Hits object? In that case you should consider using the TopDocCollector instead. The TopDocCollector(int) constructor allows you to specify the maximum number of hits you would like to have returned from your search.


In 2.4.0, you can use Searcher.search(Query query, int n) method to retrieve desired number of results. The method returns TopDocs object.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜