Dawid Weiss commented on LUCENE-7453:

bq. [...] i meant the overloading of "index", because it is used in so many 
ways (inverted index and array index, which are obviously similar, but very 
different things, one is a collection of data structures in files, and the 
other is a number).

That the term is overloaded with meanings doesn't mean this particular use case 
isn't appropriate. 

Looking at Paul's table the {{index}} column still looks semantically most 
clear to my eyes. What I like in particular is that there is no notion of the 
"index" belonging to a segment (as {{SegDocIdSet}} would imply). Rather, like I 
said before, the doc index is a logical index of a document within an index 
reader (whether it's a leaf reader or a composite doesn't matter). It nicely 
fits in loops created for {{reader.maxDoc}}, for example.

This said, everyone will have their favorites; this is probably a multicriteria 
optimisation problem with pareto-optimal set of solutions, rather than a single 

> Change naming of variables/apis from docid to docnum
> ----------------------------------------------------
>                 Key: LUCENE-7453
>                 URL: https://issues.apache.org/jira/browse/LUCENE-7453
>             Project: Lucene - Core
>          Issue Type: Improvement
>            Reporter: Ryan Ernst
> In SOLR-9528 a suggestion was made to change {{docid}} to {{docnum}}. The 
> reasoning for this is most notably that {{docid}} has a connotation about a 
> persistent unique identifier (eg like {{_id}} in elasticsearch or {{id}} in 
> solr), while {{docid}} in lucene is currently some local to a segment, and 
> not comparable directly across segments.
> When I first started working on Lucene, I had this same confusion. {{docnum}} 
> is a much better name for this transient, segment local identifier for a doc. 
> Regardless of what solr wants to do in their api (eg keeping _docid_), I 
> think we should switch the lucene apis and variable names to use docnum.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to