Dennis Gearon wrote:
why use filter queries?

Wouldn't reducing the set headed into the filters by putting it in the main 
query be faster? (A question to learn, since I do NOT know :-)

No. At least as I understand it. In the best case, the filter query will be a lot faster, because filter queries are cached seperately in the filter cache. So if the existing filter query can be found in the cache, it'll be a lot faster. If it's not in the cache, the performance should be pretty much the same as if you had included it as an additional clause in the main q query.

The reasons to put it in a fq filter are:

1) The caching behavior. You can have that certain part of the query be cached on it's own, speeding up any subsequent queries that use that same fq.

2) Simplification of client code. You can leave your 'q' however you want it, using whatever kind of query parser you want too (dismax, whatever), and just add on the 'fq' without touching the 'q'. This is a lot easier to do, and especially when you're using it for access control like this, a lot harder for a bug to creep in.

Jonathan


Reply via email to