Re: What's the most efficient way to check if there are any matches for a query?
Thanks for the suggestions. At some point I'll have to actually put it to the test and see what impact everything has. Cheers On Sat, 5 Dec 2020 at 13:31, Erick Erickson wrote: > Have you looked at the Term Query Parser (_not_ the TermS Query Parser) > or Raw Query Parser? > > https://lucene.apache.org/solr/guide/8_4/other-parsers.html > > NOTE: these perform _no_ analysis, so you have to give them the exact > term... > > These are pretty low level, and if they’re “fast enough” you won’t have to > do > any work. You could do some Lucene-level coding I suspect to improve that, > depends on whether you think those are fast enough… > > Best, > Erick > > > > On Dec 5, 2020, at 5:04 AM, Colvin Cowie > wrote: > > > > Hello, > > > > I was just wondering. If I don't care about the number of matches for a > > query, let alone what the matches are, just that there is *at least 1* > > match for a query, what's the most efficient way to execute that query > (on > > the /select handler)? (Using Solr 8.7) > > > > As a general approach for a query is "rows=0=id asc" the best I can > > do? Is there a more aggressive short circuit that will stop a searcher as > > soon as it finds a match? > > > > For a specific case where the query is for a single exact term in an > > indexed field (with or without doc values) is there a different answer? > > > > Thanks for any suggestions > >
Re: What's the most efficient way to check if there are any matches for a query?
Have you looked at the Term Query Parser (_not_ the TermS Query Parser) or Raw Query Parser? https://lucene.apache.org/solr/guide/8_4/other-parsers.html NOTE: these perform _no_ analysis, so you have to give them the exact term... These are pretty low level, and if they’re “fast enough” you won’t have to do any work. You could do some Lucene-level coding I suspect to improve that, depends on whether you think those are fast enough… Best, Erick > On Dec 5, 2020, at 5:04 AM, Colvin Cowie wrote: > > Hello, > > I was just wondering. If I don't care about the number of matches for a > query, let alone what the matches are, just that there is *at least 1* > match for a query, what's the most efficient way to execute that query (on > the /select handler)? (Using Solr 8.7) > > As a general approach for a query is "rows=0=id asc" the best I can > do? Is there a more aggressive short circuit that will stop a searcher as > soon as it finds a match? > > For a specific case where the query is for a single exact term in an > indexed field (with or without doc values) is there a different answer? > > Thanks for any suggestions
What's the most efficient way to check if there are any matches for a query?
Hello, I was just wondering. If I don't care about the number of matches for a query, let alone what the matches are, just that there is *at least 1* match for a query, what's the most efficient way to execute that query (on the /select handler)? (Using Solr 8.7) As a general approach for a query is "rows=0=id asc" the best I can do? Is there a more aggressive short circuit that will stop a searcher as soon as it finds a match? For a specific case where the query is for a single exact term in an indexed field (with or without doc values) is there a different answer? Thanks for any suggestions