You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by sujithq <su...@gmail.com> on 2007/12/06 16:13:54 UTC
SpellChecker in 2.2.0
Hi,
Is there any reason why property searcher is never closed?
This is code for the constructor
/**
* Use the given directory as a spell checker index. The directory
* is created if it doesn't exist yet.
*
* @param spellIndex
* @throws IOException
*/
public SpellChecker(Directory spellIndex) throws IOException {
this.setSpellIndex(spellIndex);
}
/**
* Use a different index as the spell checker index or re-open
* the existing index if <code>spellIndex</code> is the same value
* as given in the constructor.
*
* @param spellIndex
* @throws IOException
*/
public void setSpellIndex(Directory spellIndex) throws IOException {
this.spellIndex = spellIndex;
if (!IndexReader.indexExists(spellIndex)) {
IndexWriter writer = new IndexWriter(spellIndex, null, true);
writer.close();
}
// close the old searcher, if there was one
if (searcher != null) {
searcher.close();
}
searcher = new IndexSearcher(this.spellIndex);
}
Sujith
--
View this message in context: http://www.nabble.com/SpellChecker-in-2.2.0-tf4956508.html#a14193891
Sent from the Lucene - Java Developer mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org