lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Albert Juhe <albertj...@gmail.com>
Subject FIltering with booleanFilter
Date Tue, 25 Nov 2008 11:41:56 GMT

Hi,

I'm trying to use the boolean filter, because after a search I want to show
documents with a determinate code.

codisFiltre="XX07_04141_00853#XX06_03002_00852#UX06_07019_02994"
String[] codi =codisFiltre.split('#'); 
booleanFilter = new BooleanFilter();
        for (int i = 0; i < codi.length; i++) {
            booleanFilter.add(new FilterClause(getTermsFilter("code",
codi[i]), BooleanClause.Occur.SHOULD));
        }

 public TermsFilter getTermsFilter(String field, String text) {
        TermsFilter tf = new TermsFilter();
        tf.addTerm(new Term(field, text));
        return tf;
    }

and I use it:

hits = searcher.search(multiSearchQuery,booleanFilter, Sort.RELEVANCE);

but nothing happens I get the same results with or without filter.
I can see in the recorset the filtered codes.

What's wrong with the booleanFilter?

Thank you,
Albert
-- 
View this message in context: http://www.nabble.com/FIltering-with-booleanFilter-tp20679609p20679609.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message