[ 
https://issues.apache.org/jira/browse/LUCENE-997?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12552174
 ] 

Nadav Har'El commented on LUCENE-997:
-------------------------------------

I'd like to add my 2 cents on this issue.

The more I use Lucene in various ways, the more I'm getting convinced that the 
"Hits" API should be de-emphasized (if not outright depracated), and users 
should be encouraged to use the HitCollector API (search() taking a 
hitcollector, TopDocCollector, and so on) - especially for advanced usage.

I believe that your TimeLimitedCollector is an interesting idea. However, there 
is simply no justification to change TopDocCollector, TopFieldDocCollector, 
Topdocs, Hits and Searcher. There's a MUCH simpler, and in my opinion cleaner, 
approach: Just make TimeLimitedCollector be a front-end for another collector 
(for example, TopDocCollector) which will be passed to TimeLimitedCollector's 
constructor. For every document that is presented to TimeLimitedCollector's 
collect(), it would call the inner collector's collect().

This way, without any changes to Lucene's core APIs, and just the addition of a 
new class, you can add the new functionality that you wanted. This, I think, is 
the beauty of the HitCollector interface over the "monolithic" Hits approach, 
and I think we should encourage this way of thinking instead of adding more and 
more features to Hits.

> Add search timeout support to Lucene
> ------------------------------------
>
>                 Key: LUCENE-997
>                 URL: https://issues.apache.org/jira/browse/LUCENE-997
>             Project: Lucene - Java
>          Issue Type: New Feature
>            Reporter: Sean Timm
>            Priority: Minor
>         Attachments: LuceneTimeoutTest.java, timeout.patch, timeout.patch
>
>
> This patch is based on Nutch-308. 
> This patch adds support for a maximum search time limit. After this time is 
> exceeded, the search thread is stopped, partial results (if any) are returned 
> and the total number of results is estimated.
> This patch tries to minimize the overhead related to time-keeping by using a 
> version of safe unsynchronized timer.
> This was also discussed in an e-mail thread.
> http://www.nabble.com/search-timeout-tf3410206.html#a9501029

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to