: I am experimenting with using a custom filter with QueryParser and ran into : some unanticipated issues with using NOT terms. I narrowed down the issue
... : bquery = new BooleanQuery(); : bquery.add(new BooleanClause(fq, BooleanClause.Occur.MUST_NOT)); : hits = this.searcher.search(bquery); : assertTrue(hits.length() == 1); // <<<<<<<<< returns 0, expecting doc #2 (t2) to return... ...this isn't really a Filter issue at all, you're trying to execute a query that only contains prohibited (ie: MUST_NOT) clauses. Thus you are not positively selecting anything -- this is one of hte main use for MatchAllDocsQuery, try... bquery = new BooleanQuery(); bquery.add(new BooleanClause(fq, BooleanClause.Occur.MUST_NOT)); bquery.add(new BooleanClause(new MatchAllDocsQuery(), BooleanClause.Occur.MUST)); hits = this.searcher.search(bquery); assertTrue(hits.length() == 1); ...incidently, if you are constructing a FilteredQuery arround a MatchAllDocsQuery, you might as well use a ConstantScoreQuery instead. -Hoss --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]