[Xapian-discuss] broken code

Michael A. Lewis MAL at ICGINC.COM
Mon Jul 23 16:37:26 BST 2007


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 at lists.xapian.org on behalf of Michael A. Lewis
Sent: Sat 7/21/2007 3:48 PM
To: xapian-discuss at 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 at lists.xapian.org
http://lists.xapian.org/mailman/listinfo/xapian-discuss




More information about the Xapian-discuss mailing list