[Xapian-discuss] find document by doc path

Olly Betts olly at survex.com
Wed Nov 21 23:50:50 GMT 2007


On Mon, Nov 19, 2007 at 07:42:18PM +0100, Clemens Zeidler wrote:
> I want to update a document. The document is identified by the document
> path e.g. /home/user/file.txt. To find the doc id by the path I need to
> assign the path to the document. In the FAQ is supposed to add the doc id
> (the path) as a term to the document.

Yes, that's how I'd do it.

> My idea is to at the path as a value by
> 
> #define PATH_ID 0
> add_value(PATH_ID, "/home/user/file.txt")
> 
> and then do a query:
> 
> Query (Query::op op_, PATH_ID, "/home/user/file.txt",
> "/home/user/file.txt")

That code doesn't make sense - I assume you mean to use OP_VALUE_RANGE
here?

> Is there a drawback to do such a query on a value? Or is a query on a
> value even faster?

The major drawback is that this will be a lot slower than using a term.

Cheers,
    Olly



More information about the Xapian-discuss mailing list