I am using Lucene.Net in a personal project and need to handle to cases but can't find a nice way that lucene will handle the two cases using the same type of query.
The basic query uses a MultiFieldQueryParser with the StandardAnalyzer and a NumericRangedFilter to filter by date (dates are saved as long values).
The problem being that I would like the filter to handle an empty search string, without having to use two different query parsers, one for an empty search string and one where the user enters a search string. Currently the MultiFieldQueryParser throws a ParseException when an empty string is used.
Any advice on the best way to handle this? Or is this a flaw (intentional or otherwise) in Lucene or Lucene.Net.
RESULT
I ended up using the MatchAllDocsQuery if the query string was empty with a normal query otherwise.
Also I had to remove the use of NumericFields and the NumericRangeFilter as the query returned no results when I used them. I ended up doing the date range filter the old way with strings and a normal RangeFilter.