The short answer is no, you can't ask Solr to stop searching after the
first 100 hits are found, the retrieval and ranking phase needs to be
completed to be able to return the top-K. If you don't find the
candidates(retrieval) and rank them, how would you know what is the top-K
at all?

Then, the long answer is that Apache Solr implements already approaches for
'early termination' such as Block Max WAND from Solr 8(thanks Lucene for
this: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7148045/) to optimise
query time and 'skip un-worthy candidates'.

For your second question, you can use the
https://solr.apache.org/guide/6_6/common-query-parameters.html#CommonQueryParameters-ThetimeAllowedParameter
.
Be aware it's not a panacea and that presented some bugs in some older
versions, so make sure you grab a Solr version that has fixed the problem (
https://issues.apache.org/jira/browse/SOLR-9882)

Cheers
--------------------------
*Alessandro Benedetti*
Director @ Sease Ltd.
*Apache Lucene/Solr Committer*
*Apache Solr PMC Member*

e-mail: a.benede...@sease.io


*Sease* - Information Retrieval Applied
Consulting | Training | Open Source

Website: Sease.io <http://sease.io/>
LinkedIn <https://linkedin.com/company/sease-ltd> | Twitter
<https://twitter.com/seaseltd> | Youtube
<https://www.youtube.com/channel/UCDx86ZKLYNpI3gzMercM7BQ> | Github
<https://github.com/seaseltd>


On Wed, 8 Feb 2023 at 16:02, Andy Lester <a...@petdance.com> wrote:

> Please include your schema and some sample queries so we have specifics to
> go on.
>
> > On Feb 8, 2023, at 9:00 AM, Mike <mz579...@gmail.com> wrote:
> >
> > I have a standalone Solr server and an index of millions of documents.
> > Some queries that e.g. more than 1 million times exist takes a long time.
> > I only need the first 100 results, can I make solr stop ranking and sort
> by
> > the first 100 hits?
> > How can i limit the search time of sometimes more than 10 seconds?
> >
> > Thanks
> > Mike
>
>

Reply via email to