lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Albert Juhe <albertj...@gmail.com>
Subject Re: FIltering with booleanFilter
Date Wed, 26 Nov 2008 08:34:56 GMT

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

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


Mime
View raw message