Return-Path: Delivered-To: apmail-lucene-java-dev-archive@www.apache.org Received: (qmail 91050 invoked from network); 27 Dec 2006 13:10:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 27 Dec 2006 13:10:52 -0000 Received: (qmail 48702 invoked by uid 500); 27 Dec 2006 13:10:53 -0000 Delivered-To: apmail-lucene-java-dev-archive@lucene.apache.org Received: (qmail 48439 invoked by uid 500); 27 Dec 2006 13:10:53 -0000 Mailing-List: contact java-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@lucene.apache.org Delivered-To: mailing list java-dev@lucene.apache.org Received: (qmail 48428 invoked by uid 99); 27 Dec 2006 13:10:52 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Dec 2006 05:10:52 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Dec 2006 05:10:45 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id CDAB77142C2 for ; Wed, 27 Dec 2006 05:10:24 -0800 (PST) Message-ID: <9772397.1167225024839.JavaMail.jira@brutus> Date: Wed, 27 Dec 2006 05:10:24 -0800 (PST) From: "f (JIRA)" To: java-dev@lucene.apache.org Subject: [jira] Commented: (LUCENE-632) The creation of a spell index from a LuceneDictionary via SpellChecker.indexDictionary (Dictionary dict) fails starting with 1.9.1 (up to current svn version) In-Reply-To: <27312783.1153768093941.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ http://issues.apache.org/jira/browse/LUCENE-632?page=comments#action_12460995 ] f commented on LUCENE-632: -------------------------- i still have the problem with null pointer exceptions on creating a spell index ... first i thought its a problem with the php jni bridge i use. But after i created a java example it didnt work either. For preventing parametre missspellings or something like this i hardcoded the values in the example. import java.io.IOException; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.search.spell.Dictionary; import org.apache.lucene.search.spell.LuceneDictionary; import org.apache.lucene.search.spell.SpellChecker; import org.apache.lucene.store.Directory; import org.apache.lucene.store.FSDirectory; public class DidYouMeanIndexer { private static final String DEFAULT_FIELD = "txt_name"; public void createSpellIndex() throws IOException { IndexReader indexReader = null; try { boolean create = false; Directory orgindex = FSDirectory.getDirectory("/var/www/localhost/htdocs/lib/suche/data/index/", create); Directory spellindex = FSDirectory.getDirectory("/var/www/localhost/htdocs/lib/suche/data/didyoumean/", create); indexReader = IndexReader.open(orgindex); new IndexWriter(orgindex, null, true).close(); Dictionary dictionary = new LuceneDictionary(indexReader, "txt_name"); SpellChecker spellChecker = new SpellChecker(spellindex); spellChecker.indexDictionary(dictionary); } finally { if (indexReader != null) { indexReader.close(); } } } public static void main(String[] args) { DidYouMeanIndexer obj = new DidYouMeanIndexer(); try { obj.createSpellIndex(); } catch(IOException exception) { } } } The next step i did was debugging the behaviour of the worditerator which i got from the LuceneDictionary. But it didnt get a word. The index is well set up with one document in it with two fields. The txt_name field is tokened indexed and has a termvector. The solution of Karl Wettin didnt the job for me ;) This problem exists on my system with lucene 1.9.1 and with 2.0.1-dev I hope you have some ideas ;) scnr > The creation of a spell index from a LuceneDictionary via SpellChecker.indexDictionary (Dictionary dict) fails starting with 1.9.1 (up to current svn version) > -------------------------------------------------------------------------------------------------------------------------------------------------------------- > > Key: LUCENE-632 > URL: http://issues.apache.org/jira/browse/LUCENE-632 > Project: Lucene - Java > Issue Type: Bug > Components: Other > Affects Versions: 1.9, 2.0.0 > Reporter: Karsten Dello > Priority: Minor > Fix For: 2.0.0 > > Attachments: lazy_searcher.diff > > > Two different errors in 1.9.1/2.0.0 and current svn version. > 1.9.1/2.0.0: > at the end of indexDictionary (Dictionary dict) > the IndexReader-instance reader is closed. > This causes a NullpointerException because reader has not been initialized before (neither in that method nor in the constructor). > Uncommenting this line (reader.close()) seems to resolve that issue. > current svn: > the constructor tries to create an IndexSearcher-instance for the specified path; > as there is no index in that path - it is not created yet - an exception is thrown. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org For additional commands, e-mail: java-dev-help@lucene.apache.org