You'll have to decide whether cached or uncached filter queries work best
for your particular application. If you can us cached filter queries, that's
better, and then separating or factoring the filter query terms is better.
But if you have so much data or so little memory or such complex queries
that caching is too expensive, you can go with uncached filter queries. You
can then also assign a "cost" to each filter query to control the order they
are executed:
Example: q=*:*&fq={!cache=false cost=5}inStock:true&fq={!frange l=1 u=4
cache=false cost=50}sqrt(popularity)
See:
http://wiki.apache.org/solr/CommonQueryParameters#Caching_of_filters
But, start simple, with separate, cached, filter queries, and only get fancy
if you have problems with query latency.
-- Jack Krupansky
-----Original Message-----
From: J Mohamed Zahoor
Sent: Saturday, May 18, 2013 5:59 AM
To: solr-user@lucene.apache.org
Subject: Best query method
Hi
I am using solr 4.2.1.
My index has products from different stores with different attributes.
If i want to get the count of all products which belongs to store X which is
coloured red and is in-stock…
My question is : Which way of querying is better in-terms of "performance"
and "cache usage".
1) q=*.*&fq=(store:X) AND (colour:red) AND (in-stock:true)
2) q=store:X&fq=(colour:red) AND (in-stock:true)
3) q=store:X&fq=colour:red&fq:in-stock:true
f there is any other option better than these three.. please add let me
know..
i am assuming that which ever filter eliminates more products… should come
first (q, then list of fq's)
./zahoor
=