[Xapian-discuss] Finding a documents ID

James Aylett james-xapian at tartarus.org
Sun Apr 1 12:58:18 BST 2007


On Sat, Mar 31, 2007 at 01:45:20AM +0100, Olly Betts wrote:

> * You can create a Document object from scratch and it then has no
>   document id associated (though it could just return 0 if it didn't
>   come from a Database).

That might actually be useful, because you could keep Document objects
around and find out whether they existed in a database or not. (I
can't think of a good reason for doing this, but I can imagine some
horrendous EIS for document management that might need it.)

> * The document id doesn't mean much without also knowing the Database   
>   but if you're searching over several Database objects together then
>   the (Database, document id) pair that the Document knows is for the
>   sub-Database not the combined Database, which users might find
>   suprising...

It would just need documenting clearly that this is for clever tricks.

> Or it might be possible to have a "Document::replace()" method.

That would be cool. Hmm... can we make a combined database out of
WritableDatabase objects? If so, you could find objects across several
databases, then modify them, since the Document would be able to apply
the write operation back to the underlying concrete db.

(This actually has a use, at least for me; one of the things I'd like
to do would require me to track the underlying contributing db of
every doc, which I don't like the idea of. OTOH with single-writer
locking I wouldn't want to hold all those dbs open, so I'd need it
anyway unless I could get at the Database and then make a
WritableDatabase out of it, which would need a
Xapian::Document::get_database() call, which probably isn't a good
idea.)

J

-- 
/--------------------------------------------------------------------------\
  James Aylett                                                  xapian.org
  james at tartarus.org                               uncertaintydivision.org



More information about the Xapian-discuss mailing list