lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Johnny Jenkins <>
Subject SpellChecker adding and removing words
Date Wed, 11 Sep 2013 02:24:36 GMT
I’m wanting to high jack SpellChecker class as a general spell checking and
word suggestion tool. The idea of using this class was to avoid creating my
own.  At first it seems to fit the bill.

However, once I’ve used indexDirectory() I cannot seem to easily add/remove
words.  I can re-instantiate the SpellChecker instance and do another
indexDirectory() with the most recent dictionary, however this takes time
and I want ZERO down time.

Adding words:

I’ve attempted to add documents through an IndexWriter and I can
successfully add words into the F_WORD field.  This allows me test a word
against exist() with a successful outcome.  However when attempting to get
suggestions of a similar misspelled word it will fail to return the newly
added word.  This is because I/it never added the appropriate content into
all the other index fields (gramN, endN, startN etc) which the suggest
methods appear to rely on.

I’ve debugged the creation of the dictionary and can see that there are
some very useful private methods in the SpellChecker class
(createDocument(), addGram()).  It appears to lack word removal methods.

Am I trying to use this for something it is not designed for?  (I gather
its roots are around ‘did you mean’?)

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message