You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2022/12/10 14:00:26 UTC
[GitHub] [lucene] jpountz opened a new issue, #12005: Should we fail retrieving doc values on the wrong type?
jpountz opened a new issue, #12005:
URL: https://github.com/apache/lucene/issues/12005
### Description
Lucene currently treats the different doc-value types as if they were independent features and `LeafReader#getXXXDocValues()` returns `null` in case of mismatch, e.g. retrieving binary doc values on a field that indexed numeric doc values.
I recently learned that this behavior is considered trappy enough that some code bases [forbid these methods](https://github.com/apache/lucene/pull/11950#discussion_r1029470218), which makes me wonder if we should change our stance and fail `LeafReader#getXXXDocValues()` in case of mismatch?
--
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-unsubscribe@lucene.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
[GitHub] [lucene] rmuir commented on issue #12005: Should we fail retrieving doc values on the wrong type?
Posted by GitBox <gi...@apache.org>.
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-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [I] Should we fail retrieving doc values on the wrong type? [lucene]
Posted by "jpountz (via GitHub)" <gi...@apache.org>.
jpountz closed issue #12005: Should we fail retrieving doc values on the wrong type?
URL: https://github.com/apache/lucene/issues/12005
--
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-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org