[ 
https://issues.apache.org/jira/browse/SOLR-17237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17841887#comment-17841887
 ] 

Karl Stoney commented on SOLR-17237:
------------------------------------

Hello!
Sorry for the delay in getting back to you, I was away last week.

Whilst I was off - someone at work debugged it:

Problem's here in 9.5.0 release
https://github.com/apache/solr/blob/cdd27dd15c3a6574032e9b1b92b148ab4e383599/solr/core/src/java/org/apache/solr/schema/BinaryField.java#L61

BinaryField tells the response writer the field doesn't need escaping, then the 
Jackson writer it's picked uses that to write the raw value
https://github.com/apache/solr/blob/cdd27dd15c3a6574032e9b1b92b148ab4e383599/solr/core/src/java/org/apache/solr/response/JacksonJsonWriter.java#L131

I was going to submit a PR as it's just a case of ignoring the fields hint, 
then realised someone already fixed it last month for their UUID type problem, 
which also fixes binary
https://issues.apache.org/jira/browse/SOLR-17110
https://github.com/apache/solr/blob/main/solr/core/src/java/org/apache/solr/response/JacksonJsonWriter.java#L131

I bumped our cluster to 9.6.0 this morning and can confirm the binary field is 
now quoted:

 !Screenshot 2024-04-29 at 08.54.30.png! 


> JSON Writer appears to return invalid JSON when binary fields are used
> ----------------------------------------------------------------------
>
>                 Key: SOLR-17237
>                 URL: https://issues.apache.org/jira/browse/SOLR-17237
>             Project: Solr
>          Issue Type: Bug
>          Components: JSON Request API
>    Affects Versions: 9.5.0
>            Reporter: Karl Stoney
>            Priority: Major
>              Labels: json
>         Attachments: Screenshot 2024-04-18 at 09.16.23.png, Screenshot 
> 2024-04-29 at 08.54.30.png
>
>
> Hello, 
> As per the thread on the user group, we're currently looking at upgrading to 
> solr 9.5.0, from v8.
> We have built a fresh solr 9.5.0 from scratch, and have observed that when 
> requesting application/json, binary fields are not quoted - thus resulting in 
> invalid JSON.
> I found https://issues.apache.org/jira/browse/SOLR-10653, which looks very 
> similar, and was "fixed" in 9.5.0.
> Here's an example (partial) response that you can see (truncated the actual 
> value though):
> ```
>       "PARTNER_SITES_ADVERT_STATUS":"EXPIRED",
>       "DATE_OF_REGISTRATION_EPOCH":1584403200,
>       "STOCK_ITEM_BINARY_FIELD":OikKAfqLb3JpZ2luU291cmNlQ0....=,
>       "FUEL_CAPACITY_VALUE":59.0
> ```



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to