You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Ryan O'Hara <oh...@genome.chop.edu> on 2007/03/14 21:47:00 UTC

SpellChecker and Lucene 2.1

Is there a SpellChecker.jar compatible with Lucene 2.1.  After  
updating to Lucene 2.1, I seem to have lost the ability to create a  
spell index using spellchecker-2.0-rc1-dev.jar.  Any help would be  
greatly appreciated.

Thanks,
Ryan

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: SpellChecker and Lucene 2.1

Posted by karl wettin <ka...@gmail.com>.
15 mar 2007 kl. 15.33 skrev Ryan O'Hara:

> My question basically was is there a spellchecker-2.*1*-rc1-dev.jar?

There has been changes since 2.0. You can also take a look at this:

https://issues.apache.org/jira/browse/LUCENE-632

>
> The problems I'm having...
>
> Exception:
>
> java.lang.NullPointerException
>         at  
> org.apache.lucene.search.spell.SpellChecker.indexDictionary 
> (SpellChecker.java:298)
>         at DidYouMeanIndexer.createSpellIndex 
> (DidYouMeanIndexer.java:52)
>         at DidYouMeanIndexer.main(DidYouMeanIndexer.java:38)

Do you have the source of SpellChecker.java available too? What is on  
and around 298?

And what line of code below is row 52?


>
> Code:
>
> public void createSpellIndex(String field,
>                                  Directory originalIndexDirectory,
>                                  Directory spellIndexDirectory) {
>         IndexReader indexReaderOriginal = null;
>         try {
>             indexReaderOriginal = IndexReader.open 
> (originalIndexDirectory);
>             LuceneDictionary dictionary = new LuceneDictionary 
> (indexReaderOriginal, field);
>             //*tried closing indexReaderOriginal here too*
> 	    SpellChecker spellChecker = new SpellChecker 
> (spellIndexDirectory);
>             spellChecker.indexDictionary(dictionary);
>         } catch (Exception e){
>             printError(e);
>         } finally {
>             try {
>                 indexReaderOriginal.close();
>             } catch (Exception e){
>                 e.printStackTrace();
>             }
>         }
>     }
>
> When I close indexReaderOriginal after the Dictionary is closed, I  
> get the same exact exception.

-- 
karl


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: SpellChecker and Lucene 2.1

Posted by Ryan O'Hara <oh...@genome.chop.edu>.
Thanks a ton, Hoss.  I just did an ant on the contrib/spellchecker  
directory and it produced a jar file in the LUCENE_HOME/build/  
directory.  Replacing the old jar file with the new jar file fixed my  
errrors as I suspected.  Thanks, again.

-Ryan

On Mar 15, 2007, at 1:38 PM, Chris Hostetter wrote:

>
> : My question basically was is there a spellchecker-2.*1*-rc1-dev.jar?
>
> There *should* be a spellchecker 2.1 jar in the contrib/spellchecker/
> directory of the 2.1 release.
>
>
>
>
> -Hoss
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: SpellChecker and Lucene 2.1

Posted by Chris Hostetter <ho...@fucit.org>.
: My question basically was is there a spellchecker-2.*1*-rc1-dev.jar?

There *should* be a spellchecker 2.1 jar in the contrib/spellchecker/
directory of the 2.1 release.




-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: SpellChecker and Lucene 2.1

Posted by Ryan O'Hara <oh...@genome.chop.edu>.
My question basically was is there a spellchecker-2.*1*-rc1-dev.jar?

The problems I'm having...

Exception:

java.lang.NullPointerException
         at  
org.apache.lucene.search.spell.SpellChecker.indexDictionary 
(SpellChecker.java:298)
         at DidYouMeanIndexer.createSpellIndex(DidYouMeanIndexer.java: 
52)
         at DidYouMeanIndexer.main(DidYouMeanIndexer.java:38)

Code:

public void createSpellIndex(String field,
                                  Directory originalIndexDirectory,
                                  Directory spellIndexDirectory) {
         IndexReader indexReaderOriginal = null;
         try {
             indexReaderOriginal = IndexReader.open 
(originalIndexDirectory);
             LuceneDictionary dictionary = new LuceneDictionary 
(indexReaderOriginal, field);
             //*tried closing indexReaderOriginal here too*
	    SpellChecker spellChecker = new SpellChecker(spellIndexDirectory);
             spellChecker.indexDictionary(dictionary);
         } catch (Exception e){
             printError(e);
         } finally {
             try {
                 indexReaderOriginal.close();
             } catch (Exception e){
                 e.printStackTrace();
             }
         }
     }

When I close indexReaderOriginal after the Dictionary is closed, I  
get the same exact exception.

Thanks in advance,
Ryan

On Mar 15, 2007, at 1:34 AM, karl wettin wrote:

>
> 14 mar 2007 kl. 21.47 skrev Ryan O'Hara:
>
>> Is there a SpellChecker.jar compatible with Lucene 2.1.  After  
>> updating to Lucene 2.1, I seem to have lost the ability to create  
>> a spell index using spellchecker-2.0-rc1-dev.jar.  Any help would  
>> be greatly appreciated.
>
> Can you explain the problem more detailed? Exceptions? API changes?
>
> -- 
> karl
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: SpellChecker and Lucene 2.1

Posted by karl wettin <ka...@gmail.com>.
14 mar 2007 kl. 21.47 skrev Ryan O'Hara:

> Is there a SpellChecker.jar compatible with Lucene 2.1.  After  
> updating to Lucene 2.1, I seem to have lost the ability to create a  
> spell index using spellchecker-2.0-rc1-dev.jar.  Any help would be  
> greatly appreciated.

Can you explain the problem more detailed? Exceptions? API changes?

-- 
karl

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org