Close
dtSearch Engine API for Java
IndexingFlags.dtsIndexKeepExistingDocIds Field

Preserve existing document ids following a compression of an index or a merge of two or more indexes.

Syntax
Java
public static final int dtsIndexKeepExistingDocIds = 0x00400;

Each document in an index is assigned a unique integer identifier called a document id or "DocId". The first document added to an index has the DocId 1, and subsequent documents will have sequentially numbered DocIds 2, 3, 4, and so forth. When a document is reindexed, its DocId is "cancelled" and a new DocId is assigned. 

When an index is compressed, all DocIds in the index are renumbered to remove the cancelled DocIds unless the dtsIndexKeepExistingDocIds flag is set in IndexJob

When an index is merged into another index, DocIds in the target index are never changed. The documents merged into the target index will all be assigned new, sequentially-numbered DocIds, unless (a) the dtsIndexKeepExistingDocIds flag is set in IndexJob and (b) the indexes have non-overlapping ranges of doc ids. 

If the dtsIndexKeepExistingDocIds is set in a merge and one or more indexes have overlapping doc ids, the error dtsErConflictingDocIdRanges will be returned and the merge will halt. 

When an index is created, you can specify a starting DocId other than 1 using IndexJob.StartingDocId. This makes it possible to ensure that indexes have non-overlapping ranges of DocIds so DocIds can be preserved after the indexes are merged.