Solr query (q) or filter query (fq)

solr

Solution

It's preferable to use Filter Query over normal Query wherever possible.

FilterQuery is able to take advantage of the FilterCache, which would be a huge performance boost in comparison to your queries.

Problem

I have a ~1 mil product document Solr index. I also have a whole bunch of UI filters such as, categories, tabs, price ranges, sizes, colors, and some other filters. Is it the right way to have the q selecting everything `(q=\*:\*)` while all other filters in the fq? example: `fq=(catid:90 OR catid:81) AND priceEng:[38 TO 40] AND (size:39 OR size:40 OR size:41 OR size:50 OR size:72) AND (colorGroup:Yellow OR colorGroup:Violet OR colorGroup:Orange ... AND (companyId:81 OR companyId:691 OR companyId:671 OR companyId:628 OR companyId:185 OR companyId:602 OR ... AND endShipDays:[* TO 7])` To me, everything from categories to companyIds, from colors and sizes, etc are just filters. Any problem in performance in the future growth with this approach ? Should I put some of the queries in the q, which ones ? Thank you,

Original source