lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ian Lea" <ian....@gmail.com>
Subject Re: FIltering with booleanFilter
Date Tue, 25 Nov 2008 12:05:36 GMT
Hi


Do you maybe need MUST rather than SHOULD?


--
Ian.


On Tue, Nov 25, 2008 at 11:41 AM, Albert Juhe <albertjuhe@gmail.com> wrote:
>
> 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
>
>

---------------------------------------------------------------------
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