lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Sokolov <>
Subject Re: AnalyzingInfixSuggester questions
Date Fri, 15 Aug 2014 11:33:21 GMT
On 8/14/2014 5:48 PM, Michael McCandless wrote:
> I think we should expose commit?  Can you open an issue?
I will
> And fix the NPEs to be a more informative exc?  E.g.
> IllegalStateException w/ a reasonable message ...
> You should be able to init AIS on a previously built suggester, not
> .build() it every time your application starts...
AIS handles that for you in its constructor -- unless there is no 
existing suggester index, in which case you have to call build(). But 
how can a caller tell that AIS is in that state?  I tried calling 
getCount() to see if the index were present or not, but in that case an 
exception is raised.  I could look for a directory that it might have 
opened, and try to tell whether it's a valid index, but that breaks the 
abstraction boundary.  It would be better if AIS simply initialized 
itself with an empty index in its constructor - I've done this in a 
subclass.  With that in place, there is no issue about raising 
exceptions - the index is always available.
> Mike McCandless
> On Thu, Aug 14, 2014 at 10:50 AM, Michael Sokolov
> <> wrote:
>> I've been using AIS, and I see that it now has support for incremental
>> updates, which is great! I'm looking forward to getting suggestions from
>> newly-added documents without the need to rebuild the entire suggester
>> index. I've run into a few problems though, and I want to see if there is a
>> better way to use it, or if not, suggest some possible improvements.
>> One issue is that AIS can be in an uninitialized state where some of its
>> methods throw NPE.  For example, if you call add(), update(), or getCount()
>> before calling build(), NPE is thrown. One might say: well just don't do
>> that! But the only alternative I can see is to call whenever
>> your application starts.  I've worked around this by extending AIS and
>> calling build (with an empty InputIterator) in the constructor if I see that
>> there is no index yet. Maybe AIS would benefit from that?
>> The other question I have is how to commit() the AIS index: the writer is
>> not exposed, and there only seems to be a refresh() method, but no commit():
>> I guess I can close() the suggester and make a new one, but that somehow
>> seems more heavyweight. Why do I want to commit explicitly? Well, maybe I
>> don't need to, but somehow I feel like I should, occasionally.
>> -Mike
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> For additional commands, e-mail:
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message