Deepika0510 commented on PR #927:
URL: https://github.com/apache/lucene/pull/927#issuecomment-1144700233

   > I'm not convinced it's best to add a `timeAllowed` to `search` methods. 
This is going to be invasive if we want to support timeouts on all 
IndexSearcher methods?
   > 
   > My suggestion would be:
   > 
   >     * Introduce a `setTimeLimit` setter, that applies to all 
`search/count` methods.
   > 
   >     * Make sure that the `search/count` methods never propagate the 
exception, otherwise we're preventing users to retrieve partial results for 
e.g. `TopDocs IndexSearcher#search(Query, int)`.
   > 
   >     * Introduce a getter `isAborted` or something along these lines that 
helps users figure out if their query has timed out. This is important, e.g. to 
let the user know that some matches were skipped or to know if it's safe to 
cache results. I'm suggesting a generic name instead of `isTimedOut` or 
something more specific to timeouts because I suspect that users would like to 
be able to cancel running queries as well in the future, and it should use the 
same mechanism to know whether results are partial?
   > 
   > 
   > A consequence of this suggestion is that users should use different 
IndexSearcher instances for each query, so that they can set a different time 
limit, which users will likely compute as `now+timeout`. I think it's ok since 
IndexSearchers are lightweight wrappers around index readers?
   
   Thank you @jpountz for the suggestions. I agree with the point to make a 
setter for timeout enabling, as it would make this feature more generic to all 
`search` methods. So, I will make changes accordingly. 
   To let the user know about the partial result, I was thinking to modify 
`TotalHits.Relation` (which is used to determine how the `TotalHits.Value` 
should be interpreted) should be set to a lower bound of the total hit count 
i.e. GREATER_THAN_OR_EQUAL_TO. Will this would be helpful?
   Along with this, should we consider creating the getter you mentioned in 
`TopDocs` or `IndexSearcher` ?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to