If you use filter queries extensively, which isn't a bad thing at all, you may be wondering if there is something you can do to improve the execution time of some of your filter queries. For example, if you have some filter queries that use heavy function queries, you may want to have them executed only on the documents that passed all the other filters. Let's see how we can do this.
Before continuing reading please read the Avoiding filter caching recipe in this chapter.
The following steps will explain how we can control the order of execution of filter queries:
Let's assume we have the following query being used to get the information we need:
q=solr+cookbook&fq=category:books&fq={!frange l=10 u=100}log(sum(sqrt(popularity),100))&fq={!frange l=0 u=10}if(exists(price_a),sum(0,price_a),sum(0,price))
For the purpose of this recipe, let's also assume that
fq={!frange l=10 u=100}log(sum(sqrt(popularity...