Re : Spell Checker Index

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re : Spell Checker Index

saikrishna venkata pendyala
Hai all,
         This is what I did.
         """
         IndexReader reader = IndexReader.open("index");
         //static final File INDEX_DIR = new File("index");
         Directory directory = new RAMDirectory(index);
         SpellChecker spellchecker = new SpellChecker(directory);
         // To index a field of a user index:
         spellchecker.indexDictionary(new
LuceneDictionary(reader,"content"));
         String[] suggestions = spellchecker.suggestSimilar("fredom", 5);
         """

The problem with above code is every time I run the code it is indexing text
in "content" field.
                       {
spellchecker.indexDictionary(newLuceneDictionary(reader,"content"));
}
Is there any way I could save the spell checker index and use it straight
away.
Reply | Threaded
Open this post in threaded view
|

Re: Re : Spell Checker Index

Karl Wettin

20 jan 2007 kl. 14.51 skrev saikrishna venkata pendyala:

> Hai all,
>         This is what I did.
>         """
>         IndexReader reader = IndexReader.open("index");
>         //static final File INDEX_DIR = new File("index");
>         Directory directory = new RAMDirectory(index);
>         SpellChecker spellchecker = new SpellChecker(directory);
>         // To index a field of a user index:
>         spellchecker.indexDictionary(new
> LuceneDictionary(reader,"content"));
>         String[] suggestions = spellchecker.suggestSimilar
> ("fredom", 5);
>         """
>
> The problem with above code is every time I run the code it is  
> indexing text
> in "content" field.
>                       {
> spellchecker.indexDictionary(newLuceneDictionary(reader,"content"));
> }
> Is there any way I could save the spell checker index and use it  
> straight
> away.

You can use an FSDirectory instead of a RAMDirectory? It is simple to  
load an FSDirectory to a RAMDirectory and vice verse if that is  
something you need.





---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]