jpountz opened a new pull request, #12116:
URL: https://github.com/apache/lucene/pull/12116

   Currently stored fields have to look at binaryValue(), stringValue() and 
numericValue() to guess the type of the value and then store it. This has a few 
issues:
    - If there is a problem, e.g. all of these 3 methods return null, it's 
currently discovered late, when we already passed the responsibility of writing 
data from IndexingChain to the codec.
    - numericValue() is used both for numeric doc values and storage. This 
makes it impossible to implement a `double` field that is stored and 
doc-valued, as numericValue() needs to return simultaneously a number that 
consists of the double for storage, and the long bits of the double for doc 
values.
    - binaryValue() is used both for sorted(_set) doc values and storage. This 
makes it impossible to implement `keyword` fields that is stored and 
doc-valued, as the field returns a non-null value for both binaryValue() and 
stringValue() and stored fields no longer know which field to store.
   
   This commit introduces `IndexableField#storedValue()`, which is used only 
for stored fields. This addresses the above issues. IndexingChain passes the 
storedValue() directly to the codec, so it's impossible for a stored fields 
format to mistakenly use binaryValue()/stringValue()/numericValue() instead of 
storedValue().


-- 
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