How can I do a Filter across multiple fields in Lucene.Net? On one field I simply do:
TermQuery tool = new TermQuery(new Term("Tool", "Nail"));
Filter f = new QueryFilter(tool);
If I now wanted to add a nail length to the filter, how can I do that?
Also, I want the user to be a able to do a search with no search term (i.e. by just choosing a category) how can I do that?
I think you're asking two questions...
Question 1: Adding an additional filter
Remember,
QueryFilter
accepts any query (not justTermQuery
). Therefore, you can create aBooleanQuery
of the criteria you wish to filter on.Question 2: Searching without a search term
If the user provides no search term, you can search using a
MatchAllDocsQuery
query.