I’m doing some complex querying using Lucene 4.0, and my information-retrieval-theory buddy has told me that anywhere that I can use a filter instead of a query, I should, in order to improve performance. Therefore, I decided to take one particularly hairy component of the query and transform it into a filter. This is relatively straightforward, as there are Filter equivalents of BooleanQuery and NumericRangeQuery, but there doesn’t seem to be a TermFilter equivalent of TermQuery. There is a FieldValueFilter, but that seems only to filter on the presence of a given field, not a particular value in that field.
What filter should I use for this?
I believe TermsFilter is what you are looking for.