You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Bhavin Pandya <bh...@rediff.co.in> on 2006/09/23 08:36:47 UTC

ChainedFilter

Hi,

I am using ChainedFilter and FilteredQuery together in order to remove RangeQuery from my code.
the problem is its not working..its effect is not coming...it returns me same number of record whether i am including range or not.
Here is the snippet.


                    BooleanQuery bqone = "coming from parent function; it booleanQuery of few termsQuery"
                    RangeFilter rf[] = new RangeFilter[2];
                    rf[0]=new RangeFilter("RANGEFIELD1", 20, 30 , true,true);
                    rf[1]=new RangeFilter("RANGEFIELD2", 20, 30 , true,true);
                    isChanged = true;

                    ChainedFilter cf = new ChainedFilter(rf,ChainedFilter.AND);
                    fq=new FilteredQuery(bqone,cf);
                    
                    Hits hits = searcher.search(fq); 


Actually data is splitted across two columns ( RANGEFIELD1 and RANGEFIELD2 ) on which i want to fire range. e.g give me all records which is between 20 and 30.
so i have created two filter and passed it to chainedfilter...
but its not working ...i dont know what i m missing.... is there any better way to implement this...?

Thanks.
Bhavin pandya

Re: ChainedFilter

Posted by Bhavin Pandya <bh...@rediff.co.in>.
Hi guys,

Its is solved now....
I come to know that "If you are ANDing/ORing FilteredQuery with say 
BooleanQuery then Its not giving proper result so i added that BooleanQuery 
before creating FilteredQuery"
May be i am wrong...but i changed the sequence of my queries ...and now its 
working...
- Bhavin pandya

----- Original Message ----- 
From: "Bhavin Pandya" <bh...@rediff.co.in>
To: <ja...@lucene.apache.org>
Sent: Saturday, September 23, 2006 12:06 PM
Subject: ChainedFilter


Hi,

I am using ChainedFilter and FilteredQuery together in order to remove 
RangeQuery from my code.
the problem is its not working..its effect is not coming...it returns me 
same number of record whether i am including range or not.
Here is the snippet.


                    BooleanQuery bqone = "coming from parent function; it 
booleanQuery of few termsQuery"
                    RangeFilter rf[] = new RangeFilter[2];
                    rf[0]=new RangeFilter("RANGEFIELD1", 20, 30 , 
true,true);
                    rf[1]=new RangeFilter("RANGEFIELD2", 20, 30 , 
true,true);
                    isChanged = true;

                    ChainedFilter cf = new 
ChainedFilter(rf,ChainedFilter.AND);
                    fq=new FilteredQuery(bqone,cf);

                    Hits hits = searcher.search(fq);


Actually data is splitted across two columns ( RANGEFIELD1 and RANGEFIELD2 ) 
on which i want to fire range. e.g give me all records which is between 20 
and 30.
so i have created two filter and passed it to chainedfilter...
but its not working ...i dont know what i m missing.... is there any better 
way to implement this...?

Thanks.
Bhavin pandya


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