Hi folks, I'm hoping someone can shed some light on how filters and boolean queries work under the hood. As I understand it, the following two queries are functionally equivalent:
boolean must, term query: foo, boolean must, term query: bar term query: foo, term filter: bar What I'd like to understand is: 1) How are boolean queries run by Lucene? Are both queries (term query: foo, term query: bar) run and then set operation intersection performed to find the final document set? Or is it a staged query where term query: foo runs first, then term query: bar run on the subset returned from the first query for foo? 2) When running the above query+filter, which is run first? Specifically, if documents with the term 'foo' are an order of magnitude larger than the documents with the term 'bar', should they be swapped in the above query so that the results of the query are as small as possible before running the filter. Or does the query run against the results of the filter? Hopefully this make sense :) Thanks, Josh