jpountz commented on code in PR #12054:
URL: https://github.com/apache/lucene/pull/12054#discussion_r1068141063
##########
lucene/demo/src/java/org/apache/lucene/demo/IndexFiles.java:
##########
@@ -234,8 +234,8 @@ void indexDoc(IndexWriter writer, Path file, long
lastModified) throws IOExcepti
// field that is indexed (i.e. searchable), but don't tokenize
// the field into separate words and don't index term frequency
// or positional information:
- Field pathField = new StringField("path", file.toString(),
Field.Store.YES);
- doc.add(pathField);
+ doc.add(new KeywordField("path", file.toString()));
+ doc.add(new StoredField("path", file.toString()));
Review Comment:
I don't mind killing the BytesRef ctor, but I don't think it would be
enough. We need this field to implement `binaryValue()` so that doc values can
be indexed. But then stored fields are going to see a field where both
`stringValue()` and `binaryValue()` return non-null, and it would be a problem
for the current stored fields format which checks the binary value first, so
this `KeywordField` would be considered as a binary field by stored fields.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]