The double negatives are a byproduct of my code building the query, as the user has several fields to choose from etc, it is not done on purpose.
With luke I was able to see that: +body:memo 1 hit +body:memo -body:policy 0 +body:memo -(-body:policy) 1 +body:memo +(-body:policy) 0 In the last two cases, if I substitute policy by a non-existant word (policy is in the index) I get the same results, so the extra -() is screwing the query. For my previous tests while coding I noticed (wrongly) the extra -() was harmless...my bad. I have refactored my code so extra -() are avoided, now everything is running ok, thanks, javier On 12/20/05, Yonik Seeley <[EMAIL PROTECTED]> wrote: > I'm not sure I understand the purpose of the double negatives. > Also, a boolean query must have some non-prohibited clauses to match > anything (and mydocs in your code example violates this). > > Is the following what you are trying to do? > > BooleanQuery mbq = new BooleanQuery(); > TermQuery mydocs = body:darpa query; > MatchAllDocsQuery alldocs = new MatchAllDocsQuery(); > mbq.add(mydocs , BooleanClause.Occur.MUST_NOT); > mbq.add(alld, BooleanClause.Occur.MUST); > > -Yonik > > > On 12/20/05, javier muguruza <[EMAIL PROTECTED]> wrote: > > Hi, > > > > If I run a query like this: > > -(-body:angel) -(-body:darpa) > > I get 0 hits. As I did not find any thread about that case, I though > > ANDing with a MatchAllDocsQuery would return my desired set (all docs > > excepting the ones with angel or darpa). > > > > So more I do the following: > > BooleanQuery mbq = new BooleanQuery(); > > BooleanQuery mydocs = -body:darpa query; > > MatchAllDocsQuery alldocs = new MatchAllDocsQuery(); > > mbq.add(mydocs , BooleanClause.Occur.MUST_NOT); > > mbq.add(alld, BooleanClause.Occur.MUST); > > > > and I still get 0 hits, if I only add the alldocs query I get some > > hits, does anyone see something wrong with my approach? > > > > javier > > --------------------------------------------------------------------- > 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]
