Couple of approaches. (But not very sure if there are other better approaches) 1. Add a seperate field which is set to 1 or 0 depending upon if the self description is present or not. Then you can search by this new field. 2. Along with each self-descrition add a common idenfier word. Then you can search by this idenfier word.
----- Original Message ---- From: mattspitz <msp...@stanford.edu> To: java-user@lucene.apache.org Sent: Tuesday, June 2, 2009 9:50:51 AM Subject: Searching documents that contain a field (text of field is irrelevant) Hey! Consider a bunch of documents that represent, say, students. These students have the following attributes: 1) Student IDs 2) Name 3) Self-description (optional) So, all documents have id: and name:, but only some of the documents have an added desc: Assuming all of the fields are indexed, I can certainly search within any of the fields. That is: "+name:John desc:muffins" searches for students named John who mentioned "muffins" in their description. What I want is all documents that contain the self-description field, regardless of what that field contains. I can probably do this: "desc:*", but I'm not sure how efficient that'd be, and I wonder if there's a better way to do it. Thank you! -Matt -- View this message in context: http://www.nabble.com/Searching-documents-that-contain-a-field-%28text-of-field-is-irrelevant%29-tp23826263p23826263.html Sent from the Lucene - Java Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org