Hi Ishan,

If you want a JSON object with key => value pairs instead of a JSON array
with alternating keys and values in the response, you can add &json.nl=map
to your request.

https://solr.apache.org/guide/solr/latest/query-guide/response-writers.html#json-nl


Thomas

Op zo 16 jul 2023 om 01:41 schreef Ishan Chattopadhyaya <
ichattopadhy...@gmail.com>:

> I used classic facets after a long time, and observed that the facet.field
> results in a list of alternating keys and values:
>
> https://gist.github.com/chatman/e475d8fe8e2bf1d7890aa7f75768865e
>
> "facet_counts":{
>     "facet_queries":{},
>     "facet_fields":{
>       "unknownField":[
>         "val",1,
>         "val2",1]
>     },
> }
>
> Shouldn't it have been something like the following?
>
> "unknownField": {"val": 1, "val2": 1}
>
> Not sure if the current behaviour is intentional, but going forward does it
> make sense to change to the latter? I do understand that the JSON Facets
> API does the reasonable thing already.
>

Reply via email to