[Xapian-devel] document_id globally incrementing

Alexander Lind malte at webstay.org
Sat Dec 2 07:29:49 GMT 2006


Hi All

I have made my xapian indexer automatically create new indexes once it
reaches X documents in each, and for each document that I add to each
sub-index, I record its document_id and its index_id (relating to what
index the document ended up in).

writabledatabase_add_document()  returns document_id:s beginning from 0
for each new index when you add new documents, like you would expect.

So far all good.

Here is the problem: when I search through the indexes together (using
database_add_database() on each sub-index), all the document_id:s are
numbered globally, so it seems while writabledatabase_add_document()
reset the document_id counter for each subindex, in the subindexes they
were never reset.

So instead of having 10 sub-indexes with 50 documents in each,
document_id:s ranging from 0-50 in each, I seem to end up with 10
sub-indexes with 50 documents in each, document_id:s ranging from 0-49
in subindex 1, 50-99 in subindex 2, and so on. This would not be a
problem if writabledatabase_add_document() returned these globally
incrementing document_id:s, but it doesn't.

Sorry for the lenghty email here, but is this a bug or a feature or am I
doing something wrong?

Thank you so much for your help.
Alec



More information about the Xapian-devel mailing list