Le samedi 8 décembre 2007, Otis Gospodnetic a écrit :
> Any unclosed and unused searcher that doesn't get closed will simply get
> garbage collected when its time is up and when the GC gets to it.
>
> Are you seeing problems with the spellchecker?

We never used the spell checker, but we did use the same design to handle 
searcher-closing : waiting the gc to close them. And it was a mistake because 
the searcher was keeping open files, while we were being updating the index.
Things worked fine with the sun jvm, but with jrockit we were hitting the "too 
many file open" error.
So we finally did what Solr does: counting searcher users.

Nicolas

>
> Otis
>
> --
> Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch
>
> ----- Original Message ----
> From: sujithq <[EMAIL PROTECTED]>
> To: java-dev@lucene.apache.org
> Sent: Thursday, December 6, 2007 10:13:54 AM
> Subject: 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



-- 
Nicolas LALEVÉE
ANYWARE TECHNOLOGIES
Tel : +33 (0)5 61 00 52 90
Fax : +33 (0)5 61 00 51 46
http://www.anyware-tech.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to