Fantastic, now its working perfect.
Thank you,
Albert
prabin meitei wrote:
>
> Hi,
>
> You can use MUST an the end.
> Using your code use as
> codisFiltre="XX07_04141_00853#XX06_03002_00852#UX06_07019_02994"
> String[] codi =codisFiltre.split('#');
> *finalFilter = new BooleanFilter();*
> booleanFilter = new BooleanFilter();
> for (int i = 0; i < codi.length; i++) {
> booleanFilter.add(new FilterClause(getTermsFilter("code",
> codi[i]), BooleanClause.Occur.SHOULD));
> }
> *finalFilter = (new FilterClause(booleanFilter,
> BooleanClause.Occur.MUST));*
>
> 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,*finalFilter*, Sort.RELEVANCE);
>
>
> Hope this helps.
>
> Prabin
> toostep.com
>
> On Wed, Nov 26, 2008 at 2:04 PM, Albert Juhe <[EMAIL PROTECTED]> wrote:
>
>>
>> If I use MUST, the sentence will be Code1 AND Code2 AND Code3.
>> I would like Code1 OR Code2 OR Code3. Each document have only one code.
>>
>>
>> Ian Lea wrote:
>> >
>> > Hi
>> >
>> >
>> > Do you maybe need MUST rather than SHOULD?
>> >
>> >
>> > --
>> > Ian.
>> >
>> >
>> > On Tue, Nov 25, 2008 at 11:41 AM, Albert Juhe <[EMAIL PROTECTED]>
>> > 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: [EMAIL PROTECTED]
>> >> For additional commands, e-mail: [EMAIL PROTECTED]
>> >>
>> >>
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > For additional commands, e-mail: [EMAIL PROTECTED]
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/FIltering-with-booleanFilter-tp20679609p20696697.html
>> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/FIltering-with-booleanFilter-tp20679609p20716392.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]