I think we should expose commit? Can you open an issue? 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... Mike McCandless http://blog.mikemccandless.com On Thu, Aug 14, 2014 at 10:50 AM, Michael Sokolov <msoko...@safaribooksonline.com> 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 AIS.build() 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: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org