Hi,

I have made a simple class that parse an XML boolean expression to create predefined query .

Here is an unroll construction from an xml topic which reduce the search on path "/bssrs" and exclude the file "abstract.htm" :

       subsubTermQuery1 = new TermQuery(new Term("FILE", "abstract.htm"));
subsubBoolQuery1.add( new BooleanClause(subsubTermQuery1 , BooleanClause.Occur.SHOULD) ); subBoolQuery1.add( new BooleanClause(subsubBoolQuery1, BooleanClause.Occur.MUST_NOT) );

   subTermQuery2 = new TermQuery(new Term("PATH", "/bssrs"));
subBoolQuery2.add( new BooleanClause(subTermQuery2 , BooleanClause.Occur.SHOULD) );

boolQuery.add( new BooleanClause(subBoolQuery1, BooleanClause.Occur.MUST) );
boolQuery.add( new BooleanClause(subBoolQuery2, BooleanClause.Occur.MUST) );

That give me after boolQuery.toString() this expression :
+(-(FILE:abstract.htm)) +(PATH:/bssrs)

If  I search with boolQuery, Lucene doesn't find anything.
If I modify by hand the query from "+(-(FILE:abstract.htm)) +(PATH:/bssrs)" to "-(FILE:abstract.htm) +(PATH:/bssrs)", Lucene find the correct list of document.

Does somebody know why ?

Thanks in advance,

Nicolas






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to