I have one more question on this, should i use Thread to use this class?

The snippet did not have that.

Best regards


On 2/28/20 11:07 AM, baris.ka...@oracle.com wrote:
Thanks Mikhail. I missed that cosntructor's first parameter.

Best regards


On 2/28/20 12:53 AM, Mikhail Khludnev wrote:
Pass TopDocsCollector as the first arg into TimeLimitingCollector.

On Thu, Feb 27, 2020 at 2:31 PM <baris.ka...@oracle.com> wrote:

Hi,-

Sometimes the search takes too long even with PhraseWildcardQuery, so i
would like to limit the search time via TimeLimitingCollector API.


Thanks to Mikhail and this Forum to inform me about this API.


i checked this IndexSearcher API with Collector parameter but that API
does not have top n results as parameter:


https://urldefense.com/v3/__https://lucene.apache.org/core/8_4_1/core/org/apache/lucene/search/IndexSearcher.html__;!!GqivPVa7Brio!P89Fobv9VblNMjb3Z0bNFecF2ZKVAGKkXYDs08U5jSjitEIB46jd8d7ordNGGPkoIg$


and the TimeLimitingCollector API:


https://urldefense.com/v3/__https://lucene.apache.org/core/8_4_1/core/org/apache/lucene/search/TimeLimitingCollector.html__;!!GqivPVa7Brio!P89Fobv9VblNMjb3Z0bNFecF2ZKVAGKkXYDs08U5jSjitEIB46jd8d7ordPc66p04w$


Is there a simple example where both IndexSearcher and
TimeLimitingCollector APIs are combined?

I found this snippet and i would like to add the missing pieces here:


Counter clock = ...;
long baseline = clock.get();
// ... prepare search -> i think this means create the query here
TimeLimitingCollector collector = new TimeLimitingCollector(c, clock,
numTicks);
collector.setBaseline(baseline);
indexSearcher.search(query, collector);

// But i also would like to do the following: and how do i get results
from TimeLimitingCollector in that so much allowed time?

int totalHits = collector.totalHits;

TopDocs topdocs = collector.topdocs(); // But i cant specify Top n docs
here, right?


The collector is defined here


https://urldefense.com/v3/__https://lucene.apache.org/core/8_4_1/core/org/apache/lucene/search/Collector.html__;!!GqivPVa7Brio!P89Fobv9VblNMjb3Z0bNFecF2ZKVAGKkXYDs08U5jSjitEIB46jd8d7ordO9STfOxQ$


https://urldefense.com/v3/__https://lucene.apache.org/core/8_4_1/core/org/apache/lucene/search/TopDocsCollector.html__;!!GqivPVa7Brio!P89Fobv9VblNMjb3Z0bNFecF2ZKVAGKkXYDs08U5jSjitEIB46jd8d7ordNBKS8o3w$

Best regards



On 2/25/20 1:50 AM, baris.ka...@oracle.com wrote:
Will do, Thanks


On Feb 25, 2020, at 1:34 AM, Mikhail Khludnev <m...@apache.org> wrote:

Hello.

Meet org.apache.lucene.search.TimeLimitingCollector.

On Mon, Feb 24, 2020 at 2:51 PM <baris.ka...@oracle.com> wrote:

Hi,-

I hope everyone is doing great.


i am trying to find an api to tell Lucene Index Searcher to stop after
0.5 seconds (when it takes longer than this).

Is there such an api or plan to implement one?


Best regards



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


--
Sincerely yours
Mikhail Khludnev
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org



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


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

Reply via email to