rmuir commented on issue #12005:
URL: https://github.com/apache/lucene/issues/12005#issuecomment-1345435529

   Don't we have the `DocValues` class already for this?
   
   If you are writing an algorithm on string docvalues, you just call 
`DocValues.getSortedSet`. 
   * If the user indexed it as single-valued `SORTED`, it gift-wraps it as a 
singleton SortedSet instance
   * If the user indexed it as multi-valued `SORTED_SET`, it returns it
   * If the user indexed it as something else (e.g. number), it throws error.
   
   Then, if you wish, you can specialize the single-valued case by checking 
`DocValues.unwrapSingleton`.
   * If the user indexed it as single-valued `SORTED`, you can process it with 
specialized algorithm.
   * If the user indexed it as multi-valued `SORTED` but no documents actually 
have multiple values, you can process it with specialized algorithm (since 
codecs use this same "gift-wrapping").
   
   I think for stuff like queries this is always the way to go. Maybe just 
javadoc-link it from LeafReader.java?
   
   But IMO leafreader should stay simple and not do such "shenanigans" as 
things like CheckIndex, merge, etc need to work low-level.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to