.net – “FindAll” feature in Lucene.net


I have two fields on my web page ie: BookAuthor and BookDescription.On submit,the page searches against lucene index using the given search criteria.

If the user does not type in anything in the two fields and submits the page, how do make Lucene.Net return all the books from my index irrespective of BookAuthor and BookDescription field values?


Best Solution

I'm not sure if this is the correct way but you could add another non nullable term to the index (say BookIsPublished) with a default value and if no search term is entered by the user return all matching items on the BookIsPublished constant field.