Hi David, On 4/22/2009 at 4:15 PM, David Seltzer wrote: > I have some code that dynamically creates a Boolean query designed to > work as a filter. After the query runs I end up with this filter. > > Filter: QueryWrapperFilter(+(-SourceID:100) > +spanNear([ArticleContent:nuclear, ArticleContent:proliferation], 30, > false)) > > My expectation is that this should limit the resultset to only results > that matches 'nuclear' NEAR 'proliferation' and are not tagged with > SourceID 100. Can anyone think of a reason that this would exclude all > content? > > There are plenty of legitimate hits. > > Is the +(-SourceID:100) a problem?
Prohibited clauses need a non-prohibited sibling clause in order to function. +(-SourceID:100) means: /+/ : only match docs from: /-SourceID:100/ : do not match docs with SourceID:100, from: //: (the empty set) That last line is the key here: you're excluding docs from a set that was empty to begin with. You can remedy this either by removing the required clause around the prohibited clause, i.e.: Filter: QueryWrapperFilter(-SourceID:100 +spanNear([ArticleContent:nuclear, ArticleContent:proliferation], 30, false)) or by adding a MatchAllDocsQuery to the required clause containing the prohibited clause: Filter: QueryWrapperFilter(+(-SourceID:100 *:*) +spanNear([ArticleContent:nuclear, ArticleContent:proliferation], 30, false)) Steve --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org