Close
dtSearch .NET Standard API 2023.02
SearchResultsItem.DocId Property

An integer that uniquely identifies each document in an index.

public Int32 DocId;

Each document in an index is assigned a unique integer identifier called a "DocId" or document id. 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. Compressing an index renumbers all of the DocIds, so after an index has been compressed, a document's DocId may change.  

DocIds are used in:

  • SearchFilter objects, which use DocIds to identify the documents selected in the filter.
  • SearchResults.AddDoc, which lets you add a document to a SearchResults list by providing the index path and the DocId. You can use this to get the properties of the document from its DocId.
  • The IndexJob.ToRemoveListName list, which lets you remove documents from an index either by name or by DocId.