Question: JavaBinCodec cannot handle BytesRef object

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Question: JavaBinCodec cannot handle BytesRef object

Boqi Gao
Dear all:

We are facing a problem recently when we are utilizing BinaryDocValueField of solr 7.3.1.
We have created a binary docValue field.
The constructor of BinaryDocValuesField(String name, BytesRef value) needs a BytesRef object to be set as its fieldData.

However, the JavaBinCodec cannot handle a BytesRef object. It writes the BytesRef as a string of class name and value.
(please see: https://github.com/apache/lucene-solr/blob/releases/lucene-solr/7.3.1/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java#L247)

And the response is like:
"response":{"docs":[
      { fieldName: "org.apache.lucene.util.BytesRef:[3c c1 a1 28 3d ……]”}
]
}

However, if the value of the field could be handled as a BytesRef object by JavabinCodec, the TextResponseWriter will write the response as a Base64 string.
(please see:
https://github.com/apache/lucene-solr/blob/releases/lucene-solr/7.3.1/solr/core/src/java/org/apache/solr/response/TextResponseWriter.java#L190-L192
https://github.com/apache/lucene-solr/blob/releases/lucene-solr/7.3.1/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java#L247
)

And the response, which we hope to get, is like:
"response":{"docs":[
      { fieldName: "vApp0zDtHj69e9mq……”}
]
}

We would like to ask that do you have any idea or suggestion to fix this problem? We hope to get a response of Base64 string.
Many thanks!

Best wishes,
Gao