Hi Team,

High Query Time in Solr When Using OR with frange in fq

We are experiencing high query times in Solr when using an fq filter that
combines an OR condition with frange. The response time significantly
increases compared to queries that do not use this combination.

Query Example
fq={!cache=false tag=prm}field:value OR {!frange l=1 u=1 v=$funcQuery}

Here, $funcQuery is a function query that retrieves documents dynamically
based on dynamic parameters.

Observations
1) When we use just {!frange l=1 u=1 v=$funcQuery}, the query executes
quickly[20ms].
2) When we use {!cache=false tag=prm}field: value alone, the query is also
fast, its working fast with the AND operator.
3) However, when combining both with OR, the query time increases
significantly [700ms].
4) The dataset is relatively large, but other queries with similar
complexity run efficiently.

Question
1) Why does the OR operation with frange cause a significant increase in
query time?
2) Are there any optimizations or alternative query structures that could
improve performance?
3) Would it help to restructure how function queries and filters are
applied in this case?
4) Is there any alternative for frange for this use case because in our use
case, this cannot be done at index time because the function parameters
change very frequently?

Any insights or suggestions would be greatly appreciated.

Reply via email to