lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Lea <>
Subject Re: Improving disk efficiency for autocompleter / spellchecker
Date Fri, 10 Jun 2011 13:10:11 GMT
Not opening the index for every keypress should make a big difference!

Most of  the tips in will apply.


On Fri, Jun 10, 2011 at 1:52 PM, Elmer <> wrote:
> Hello again :)
> I've created a autocompleter class, based on the contrib SpellChecker
> source code (it creates start1-20 grams, no middle/end grams). The use
> case for this class, as with most autocompleters, is that it is called
> on each keypress from the user.
> What happens is, that on each keypress, a static method
> 'autocompleteOnField' is called, which creates a new instance of
> AutoCompleter:
> autoCompleter = new AutoCompleter(
> File(pathToIndex)));
> It has a finalize block where it calls the close method of the
> AutoCompleter (works the same as SpellChecker). In practice, this means
> that every time a key is hit in the search field, my HDD led blinks.
> Since I'd like to have an efficient program and reduce stress on the
> hard drives as much as possible, I'd like to know if there are some
> tricks to reduce this usage.
> I already tried using a RAMDirectory instead of FSDirectory, but this
> eats up too much memory (out-of-mem exception).
> I'm currently changing the code to have a single instance of the
> AutoCompleter that is reused every time 'autocompleteOnField' is called
> -> File(pathToIndex)) and autocompleter.close()
> will only be invoked once (until the index is rebuilt/updated), which
> will probably reduce the IO reads/writes.
> Are there more ways to improve disk efficiency?
> BR,
> Elmer
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message