It is protected because the abstract base class makes it protected, for 
subclasses to implement it, but it is internal so should not be accessed from 
the outside -> only RewriteMethod may access it (which gets the term enum). 
NumericRangeQuery is just an implementation of MultiTermQuery and is final!

 

Uwe

 

-----

Uwe Schindler

H.-H.-Meier-Allee 63, D-28213 Bremen

 <http://www.thetaphi.de/> http://www.thetaphi.de

eMail: u...@thetaphi.de

 

From: chetanv...@gmail.com [mailto:chetanv...@gmail.com] On Behalf Of Chet Vora
Sent: Tuesday, October 01, 2013 3:53 PM
To: Michael McCandless
Cc: Lucene/Solr dev
Subject: Re: NumericRangeTermsEnum

 

Since its a final class, its not possible to subclass it, which is why I 
wondered aloud earlier about the choice to make it protected in a final class. 
;-). I'll see if the other way you suggested (rewrite) gives me access to the 
terms we need. 

 

We chain together multiple custom built filters... I am just overriding the 
filter.getDocIdSet() method and using the TermsEnum API to filter things we 
need from our index in a customized way. I should say its more the "custom" 
part than the "performant" part which is the reason why we want to use the 
TermsEnum api.

 

BTW, I compiled a private Lucene core jar after changing the method to public 
and it seemed to work fine. 

 

CV

 

On Mon, Sep 30, 2013 at 4:35 PM, Michael McCandless <luc...@mikemccandless.com> 
wrote:

Well, it was protected just because we didn't think apps needed to
call it directly.

You could workaround it ... subclass it and add your own public method
that delegates to .getTermsEnum.  Or access it via reflection.

Alternatively, just call Query.rewrite() and the returned Query will
reflect the terms that the original query had expanded to (though, it
may rewrite to MultiTermQueryWrapperFilter, which won't get you the
terms ...).

But, can you describe more how you plan to create performant filters
from this method?

Mike McCandless

http://blog.mikemccandless.com



On Mon, Sep 30, 2013 at 1:18 PM, Chet Vora <chetv...@gmail.com> wrote:
> Mike
>
> We want to use the lower level Terms API to create some custom high
> performant filters ... is there any reason why the method
> NumericRangeQuery.getTermsEnum() was made protected in the API as opposed to
> public?
>
> CV
>
>
> On Fri, Sep 27, 2013 at 4:15 PM, Michael McCandless
> <luc...@mikemccandless.com> wrote:
>>
>> Normally you'd create a NumericRangeFilter/Query and just use that?
>>
>> Under the hood, Lucene uses that protected API to visit all matching
>> terms...
>>
>> Mike McCandless
>>
>> http://blog.mikemccandless.com
>>
>>
>> On Thu, Sep 26, 2013 at 9:59 AM, Chet Vora <chetv...@gmail.com> wrote:
>> > Hi all
>> >
>> > I was trying to use the above enum to do some range search on dates...
>> > this
>> > enum is returned by NumericRangeQuery.getTermsEnum() but I realized that
>> > this is a protected method of the class and since this is a final class,
>> > I
>> > can't see how I can use it. Maybe I'm missing something ?
>> >
>> > Would appreciate any pointers.
>> >
>> > Thanks
>> >
>> > CV
>
>

 

Reply via email to