Eric Parusel
2004-Oct-21 22:02 UTC
[Xapian-discuss] TCL Binding working, but db_lock doesn't get removed?
Ok, I've gotten my test.tcl test script to write documents to a xapian database, thanks for all the help I've received so far! Only after the script ends, next time I try to run it, it complains about the lock present (the db_lock file is in the directory). I have to manually delete the db_lock to be able to run the script again it seems. Is there a particular way I should be destroying the WritableDatabase object? By the way: I'm using... db replace_document 1 doc Where db is a WritableDatabase object and where doc is a Document object ...as a way of setting the docid (I already have a system of unique idnumbers starting from 1, I assume a docid can handle any positive signed int32?), am I doing this correctly? Thanks, Eric
Olly Betts
2004-Oct-21 23:05 UTC
[Xapian-discuss] TCL Binding working, but db_lock doesn't get removed?
On Thu, Oct 21, 2004 at 02:03:31PM -0700, Eric Parusel wrote:> Only after the script ends, next time I try to run it, it complains > about the lock present (the db_lock file is in the directory). > > I have to manually delete the db_lock to be able to run the script again > it seems.Sounds like the destructor for Xapian::WritableDatabase isn't being run.> Is there a particular way I should be destroying the WritableDatabase > object?For Tcl, I really don't know - sorry! Perhaps Michael will be able to suggest something. It's not just the lock file - unless you explicitly flush before the script exits, you're rely on the destructor to flush the last batch of changes.> db replace_document 1 doc > > Where db is a WritableDatabase object and > where doc is a Document object > > ...as a way of setting the docid (I already have a system of unique > idnumbers starting from 1, I assume a docid can handle any positive > signed int32?), am I doing this correctly?Any positive unsigned 32 bit integer is fine (0 isn't). The compression schemes used in the tables assume the docids aren't sparse. Something like an auto-incrementing uid field from a SQL database should work well. Something like using document hashes or machine IP addresses as the docids probably wouldn't (although there's also overhead for storing and using a UID term...) Cheers, Olly