Hello list, looks like one can open a Xapian database in read-only mode and do the following: $db = Search::Xapian::Database->new("/foo/bar/"); $enq = $db->enquire("XIDblub"); the same doesn't seem to be possible with a database opened in read-write mode: $db = Search::Xapian::WritableDatabase->new("/foo/bar/", Search::Xapian::DB_CREATE_OR_OPEN); $enq = $db->enquire("XIDblub"); I first thought that this would be caused by a missing wrapper in Search::Xapian::WritableDatabase but when i duplicate the code from Search::Xapian::Database i get the following error: Search::Xapian::Enquire::new() -- databases is not a "Search::Xapian::Database" object at ./indexer.pl line 241. This is pretty disappointing since fetching a document by index-term is rather neccessary during indexing -- or how should one fetch a document to replace it during re-indexing without enquires to the database? TIA Ralf Mattes
On Fri, Jul 15, 2005 at 02:11:36AM +0200, R. Mattes wrote:> I first thought that this would be caused by a missing wrapper in > Search::Xapian::WritableDatabase but when i duplicate the code from > Search::Xapian::Database i get the following error: > > Search::Xapian::Enquire::new() -- databases is not a > "Search::Xapian::Database" object at ./indexer.pl line 241.Instead (or maybe as well) you'll need to tell Perl that WritableDatabase is a subclass of Database. To do this edit Xapian/WritableDatabase.pm and add 'Search::Xapian::Database' to "@ISA". Let me know if you find out what's required to get this working...> This is pretty disappointing since fetching a document by index-term > is rather neccessary during indexing -- or how should one fetch a document > to replace it during re-indexing without enquires to the database?No, it should work as you expect - it's just not wrapped correctly at the moment. Cheers, Olly
Pronichev Alexander
2005-Jul-15 15:13 UTC
[Xapian-devel] Problem with Perl bindings (enquire)
> This is pretty disappointing since fetching a document by index-term > is rather neccessary during indexing -- or how should one fetch a document > to replace it during re-indexing without enquires to the database?You may use "replace_document" method of Xapian::WriteableDatabase, if you know document id. Or you have a set of terms neither set of document ids in your indexer? -- WBR dyker Agava Software