I had to do this once and I put a field called "all" with a value of "true" for every 
document.

_doc.addField(Field.Keyword("all", "true"));

Then, if there was an empty query, I would substitute it for the query "all:true".  
And, of course, every doc would match this.

There might be a MUCH more elegant solution, but this certainly worked for me and was 
quite easy to incorporate.  And, it appears to order the documents by the order in 
which they were indexed.

T

p.s. You can probably do something using IndexReader directly... but the nice thing 
about this approach is that you are still just using a simple query.

-----Original Message-----
From: Patrick Burleson [mailto:[EMAIL PROTECTED]
Sent: Friday, August 13, 2004 3:25 PM
To: Lucene Users List
Subject: Finding All?


Is there a way for lucene to find all documents? Say if I have a
search input and someone puts  nothing in I want to go ahead and
return everything. Passing "*" to QueryParser was not pretty.

Thanks,
Patrick

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to