Yes I've seen that syntax too used to search for null values. You can do -(reporter:* AND -reporter:[* to *]) which says all values minus docs with a value.
Your suggestion did the trick, thanks! On Mon, Dec 8, 2008 at 11:40 AM, Erick Erickson <[EMAIL PROTECTED]>wrote: > That'll teach me to scan e-mail. You can't use MatchAllDocsQuery > that way. > What you're actually searching for is the word "matchalldocsquery" > in the field "summary". Which returns nothing. Then you're subtracting > any documents with reporter *mark*. That isn't what you're after at all. > > If you're doing this programmatically, you want something in the > Lucene code like: > > BooleanQuery bq = new BooleanQuery() > bq.add(new MatchAllDocsQuery(), BooleanClause.occur.MUST) > bq.add(<parsed *mark* query here>, BooleanClause.occur.MUST_NOT) > > > now pass bq to the search method. This will require some work on your > part to detect when it's appropriate and when it's not. But presumably you > have the ability to know that. > > I've seen referenced (but haven't used) something like > reporter:(* TO *) -reporter:*mark* > > WARNING: I've seen this referenced in, I believe, the SOLR mailing > list. I don't know how it plays in straight Lucene,and I have no idea > what the gotcha's are, nor what version of Lucene supports this syntax > efficiently. Furthermore I'm unclear what the behavior for > a document without the reporter field is...... > > But I do know that you can't do what your example does.... > > FWIW > Erick > > > On Mon, Dec 8, 2008 at 10:24 AM, no spam <[EMAIL PROTECTED]> wrote: > > > The reason our users want to do this is because they want to search for > > instances where certain negative conditions are true. My client is the > > news > > industry and this is metadata for things like reporter, type, etc. > > Sometimes you want -reporter:mark for example and this is the only > > criteria > > to search against the index. > > > > Am I thinking about this wrong? > > > > I did try using the MatchAllDocsQuery class and it expands to something > > like > > this: > > > > summary:matchalldocsquery -reporter:*mark* > > > > but I don't get any results which is not what I expect for my does not > > contain query above. > > > > On Sat, Dec 6, 2008 at 11:06 PM, Anshum <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > > > > An easy way to do that would be to index a particular term with all > docs > > > e.g. "dummyword" could be indexed for all documents as a value for a > > > dummyfield or an existing field. > > > This way lets assume you want to fetch results for -filed1:jakarta > > > You could search for dummyfield:"dummyword" AND NOT filed1:jakarta > > > > > > This is just one of the solution, though I still would not understand > if > > > there's a logical reason for fetching such results.:) > > > > > > -- > > >