lucene-java-user mailing list archives

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


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

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 =,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,
View this message in context:
Sent from the Lucene - Java Users mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message