Find all properties in Lucen
I have the following two fields in my web page: BookAuthor
and BookDescription
. On the View page, the page searches the Lucene index using the specified search criteria.
If the user does not enter anything in the two fields and does not submit the page, how do I get Lucene.Net to return all books from my index regardless of the field values BookAuthor
and BookDescription
?
source to share
The general solution here is to add a different field to each document in your index. This is a bogus field like "ALL_RECORDS" that contains some bogus value like "x". Lucene does not accept an empty request, so if the user tries to execute it, your application replaces it with a request like ALL_RECORDS: x that returns every record.
source to share