-
Notifications
You must be signed in to change notification settings - Fork 84
Description
The way sunburnt uses filter queries (fq parameter) is far from optimal from caching point of view.
Solr allows to use more than one fq parameter to provide many filter queries which are executed and cached separately and then intersected using very fast algorithms.
Sunburnt does not give possibility to build a query with more than one fq parameter.
For example:
`````` si.query().filter(field1=True).filter(field2=False)will produce something like this:?q=:&fq=field1:true AND field2:false```
but, from caching point of view, it would be much better to produce something like this:
```?q=:&fq=field1:true&fq=field2:false```
Both cases will give the same results, but in first case Solr would cache and reuse resultset for field1:true AND field2:false as one. In second case there would be 2 separate resultsets cached and reused for field1 and field2.
After changing the query like this:
si.query().filter(field1=True).filter(field2=True)
the cache for field1:true would be already populated and reused requiring only executing query and populating cache for field2:true.
This change would still allow to build a query with "AND" in fq like this:
si.query().filter(si.Q(field1=True) & si.Q(field2=False))