FAQ
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: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 5 of 10 | next ›
Discussion Overview
groupjava-user @
categorieslucene
postedJul 6, '06 at 7:53p
activeJul 22, '06 at 8:16a
posts10
users6
websitelucene.apache.org

People

Translate

site design / logo © 2022 Grokbase