I'm looking for a little help with my rather simple indexer that was working fine under 0.9.x and now no longer is. The code is: try { Xapian::WritableDatabase database(dbname, DB_CREATE_OR_OPEN); Xapian::TermGenerator indexer; Xapian::Stem stemmer("english"); indexer.set_stemmer(stemmer); Xapian::Document doc; doc.set_data(line); indexer.set_document(doc); indexer.index_text(line); if (meta) { doc.set_data(metatext); } docid=database.add_document(doc); } catch (const Error &error) { sprintf(tmp,"ERROR:-6 %s",error.get_msg().c_str()); log_it(tmp); dbError(tmp); } which as you can see is a minor modification of the simpleindex.cc code. I modified my code from the old-style indexing to using termgenerator. The problem is that the indexer.index_text(line); fails silently. I placed debug lines before the call and after. The after is never executed and the module (which is running in the background as a daemon) is no longer running. The CATCH code is never reached either. I have verified that all the xapian libraries are the 1.0.2 variety and that the xapian include files are up to date (this is the only version of xapian installed on this server), Any guidence would be appreciated, -Michael
Further information on my problem. There is a segmentation fault raised on the index_text() call. None of the database files are updated and the flintlock file is left in the database directory. If I yank the indexing code out of the program (everything in the try code) it works fine, in another program where I set the text to be indexed as "line="This is some text to be indexed.\nThis is a second line". The program that fails just reads the text to be indexed into a variable defined as "string line". The code that reads the text in is identical between the 0.9 and the 1.0.2 versions. The only thing that changed in the program code was the termgenerator usage in the try block. -Michael ________________________________ From: xapian-discuss-bounces@lists.xapian.org on behalf of Michael A. Lewis Sent: Sat 7/21/2007 3:48 PM To: xapian-discuss@lists.xapian.org Subject: [Xapian-discuss] broken code I'm looking for a little help with my rather simple indexer that was working fine under 0.9.x and now no longer is. The code is: try { Xapian::WritableDatabase database(dbname, DB_CREATE_OR_OPEN); Xapian::TermGenerator indexer; Xapian::Stem stemmer("english"); indexer.set_stemmer(stemmer); Xapian::Document doc; doc.set_data(line); indexer.set_document(doc); indexer.index_text(line); if (meta) { doc.set_data(metatext); } docid=database.add_document(doc); } catch (const Error &error) { sprintf(tmp,"ERROR:-6 %s",error.get_msg().c_str()); log_it(tmp); dbError(tmp); } which as you can see is a minor modification of the simpleindex.cc code. I modified my code from the old-style indexing to using termgenerator. The problem is that the indexer.index_text(line); fails silently. I placed debug lines before the call and after. The after is never executed and the module (which is running in the background as a daemon) is no longer running. The CATCH code is never reached either. I have verified that all the xapian libraries are the 1.0.2 variety and that the xapian include files are up to date (this is the only version of xapian installed on this server), Any guidence would be appreciated, -Michael _______________________________________________ Xapian-discuss mailing list Xapian-discuss@lists.xapian.org http://lists.xapian.org/mailman/listinfo/xapian-discuss
On Mon, Jul 23, 2007 at 11:37:26AM -0400, Michael A. Lewis wrote:> Further information on my problem. There is a segmentation fault > raised on the index_text() call. None of the database files are > updated and the flintlock file is left in the database directory. If > I yank the indexing code out of the program (everything in the try > code) it works fine, in another program where I set the text to be > indexed as "line="This is some text to be indexed.\nThis is a second > line". The program that fails just reads the text to be indexed into > a variable defined as "string line". The code that reads the text in > is identical between the 0.9 and the 1.0.2 versions. The only thing > that changed in the program code was the termgenerator usage in the > try block.Does it happen every time, or only on some inputs? There may be a bug in the term generator to do with specific types of text or something... J -- /--------------------------------------------------------------------------\ James Aylett xapian.org james@tartarus.org uncertaintydivision.org
It appears to happen everytime. That was an early thought of mine as I was using a 14k source of an HTML page as my test input. I modified the file to contain "This is the text to be indexed.". It failed there also. -Michael ________________________________ From: xapian-discuss-bounces@lists.xapian.org on behalf of James Aylett Sent: Mon 7/23/2007 11:44 AM To: xapian-discuss@lists.xapian.org Subject: Re: [Xapian-discuss] broken code On Mon, Jul 23, 2007 at 11:37:26AM -0400, Michael A. Lewis wrote:> Further information on my problem. There is a segmentation fault > raised on the index_text() call. None of the database files are > updated and the flintlock file is left in the database directory. If > I yank the indexing code out of the program (everything in the try > code) it works fine, in another program where I set the text to be > indexed as "line="This is some text to be indexed.\nThis is a second > line". The program that fails just reads the text to be indexed into > a variable defined as "string line". The code that reads the text in > is identical between the 0.9 and the 1.0.2 versions. The only thing > that changed in the program code was the termgenerator usage in the > try block.Does it happen every time, or only on some inputs? There may be a bug in the term generator to do with specific types of text or something... J -- /--------------------------------------------------------------------------\ James Aylett xapian.org james@tartarus.org uncertaintydivision.org _______________________________________________ Xapian-discuss mailing list Xapian-discuss@lists.xapian.org http://lists.xapian.org/mailman/listinfo/xapian-discuss