Re: Processing order of q and fq parameters

2024-12-22 Thread Mingchun Zhao
Hi Mikhail, Thank you for your explanation. > Thus, if we put fq={!... cost=200 cache=false } ..., it will defer filter execution, and just check a few docs matching the main query - a huge performance boost. I understood that the performance boost is achieved by intersecting the smaller set aga

Re: Processing order of q and fq parameters

2024-12-22 Thread Mikhail Khludnev
Let's have highly selective q (matches a few docs), and weakly selective fq (matches many documents, let it be a kind of access control query). If we query them as is, it will took a while to materialize heavy filter query eagerly, and then just check intersection with a few query results. Thus, if

Re: Processing order of q and fq parameters

2024-12-22 Thread Mingchun Zhao
Hi Mikhail, Thanks for your answer! > Here are two answers. Order of calling BQ.Builder.add() doesn't decide the > order of execution, as well as occur. > BooleanQuery lazily executes intersection dynamically and adjusts to actual > values, with many conditions and spec cases. Understood! > How

Re: Processing order of q and fq parameters

2024-12-20 Thread Mikhail Khludnev
On Thu, Dec 19, 2024 at 4:51 PM Mingchun Zhao wrote: > Hi Mikhail, > > ``` > return new BooleanQuery.Builder() > .add(scoreQuery, Occur.MUST) > .add(filterQuery, Occur.FILTER) > .build(); > ``` > > So, I have two questions here: > > Question 1: Does this imply that the index search with the q par

Re: Processing order of q and fq parameters

2024-12-19 Thread Mingchun Zhao
Hi Mikhail, Thank you for providing such useful information! > Regular filter is executed and cached (if it's a case) first, then query is executed, and post-filter is checked by every doc found. >From this source, it seems that when creating a BooleanQuery by combining a scoreQuery(q parameter)

Re: Processing order of q and fq parameters

2024-12-19 Thread Mikhail Khludnev
On Thu, Dec 19, 2024 at 10:42 AM Mingchun Zhao wrote: > Hi Ufuk, > > Thank you very much for your response! > > > Take a look at the cache and cost local parameters here: > > https://solr.apache.org/guide/solr/latest/query-guide/common-query-parameters.html#cache-local-parameter > > > > > Otherw

Re: Processing order of q and fq parameters

2024-12-19 Thread Mikhail Khludnev
Right. Regular filter is executed and cached (if it's a case) first, then query is executed, and post-filter is checked by every doc found. On Thu, Dec 19, 2024 at 7:42 AM ufuk yılmaz wrote: > Hello Zhao-san > > Take a look at the cache and cost local parameters here: > https://solr.apache.org/g

Re: Processing order of q and fq parameters

2024-12-18 Thread Mingchun Zhao
Hi Ufuk, Thank you very much for your response! > Take a look at the cache and cost local parameters here: https://solr.apache.org/guide/solr/latest/query-guide/common-query-parameters.html#cache-local-parameter > If a filter query is not cached and it is very expensive, it is possible to tell So

Re: Processing order of q and fq parameters

2024-12-18 Thread ufuk yılmaz
Hello Zhao-san Take a look at the cache and cost local parameters here: https://solr.apache.org/guide/solr/latest/query-guide/common-query-parameters.html#cache-local-parameter If a filter query is not cached and it is very expensive, it is possible to tell Solr to execute it after all other q

Processing order of q and fq parameters

2024-12-18 Thread Mingchun Zhao
Hi, When a search query includes both q and fq parameters, which one is executed first internally (in Solr or Lucene)? Additionally, is it possible to change this execution order? Regards, Mingchun