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) and a filterQuery(fq parameter), the scoreQuery is
added first, followed by the filterQuery.

https://github.com/apache/solr/blob/61609b1b599b839952fe6a8f0e163254caddd472/solr/core/src/java/org/apache/solr/search/QueryUtils.java#L260

```
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 parameter is
executed first, followed by the index search with the fq parameter?
Question 2: Regardless of the processing order of index searches for the q
parameter and the fq parameter, I believe that the overall search
performance remains unaffected. Is this understanding correct please?

> here we go
>
https://github.com/apache/solr/blob/61609b1b599b839952fe6a8f0e163254caddd472/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java#L1889

This was such a helpful hint. Thank you very much.

Regards,
Mingchun

Reply via email to