How can I get a DocId when adding a document to the Lucene index?

I am indexing a row of data from a database in Lucene.Net. A string is equivalent to a document.

I want to update my database with DocId so that I can use DocId in the results to get rows quickly.

I am currently first extracting PK from result documents, which in my opinion should be slower than returning directly from the database using DocId.

How can I find DocId when adding a document to Lucene?

+5
source share
2 answers

As Yuval stated, the leak of internal details of Lucene's implementation is bad, especially since the Lucene doc identifier changes when the index is mutated.

doc.get( "pk" ) , FieldCache pk . .

+2

Lucene DocId - , . DocId. auto-increment. , . , - , Lucene , . , :

  • Lucene, DocId.
  • DocId .
+3

All Articles