[
https://issues.apache.org/jira/browse/SOLR-3163?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sujit Pal closed SOLR-3163.
---------------------------
Resolution: Invalid
Fix Version/s: 3.5
This is a known feature and not a bug to preserve order. Closing.
> FacetComponent returns list of alternate name, value instead of map for
> counts in JSON responses
> ------------------------------------------------------------------------------------------------
>
> Key: SOLR-3163
> URL: https://issues.apache.org/jira/browse/SOLR-3163
> Project: Solr
> Issue Type: Bug
> Components: SearchComponents - other
> Affects Versions: 3.5
> Reporter: Sujit Pal
> Priority: Minor
> Labels: facet
> Fix For: 3.5
>
>
> Facet counts for facet.field come back in JSON format like this (a list of
> name and values, where even positions are keys and odd positions are values).
> {quote}
> "facet_counts":{
> "facet_fields":{
> "u_idx":[
> "section",39663,
> "adam",6211,
> "image",3840,
> "slideshow",2480],
> ...
> {quote}
> unlike facet.query facet counts, which come back like this (a map of name
> value pairs).
> {quote}
> "facet_queries":{
> "u_reviewdate:[NOW-6MONTH TO NOW]":42,
> "u_reviewdate:[NOW-1YEAR TO NOW-6MONTHS]":1561,
> "u_reviewdate:[NOW-2YEAR TO NOW-1YEAR]":3017,
> "u_reviewdate:[NOW-5YEAR TO NOW-2YEAR]":1538,
> "u_reviewdate:[NOW-100YEAR TO NOW-5YEAR]":47},
> {quote}
> This is only for wt=json. With wt=xml, the two formats look similar.
> {quote}
> <lst name="facet_queries">
> <int name="u_reviewdate:[NOW-6MONTH TO NOW]">42</int>
> <int name="u_reviewdate:[NOW-1YEAR TO NOW-6MONTHS]">1561</int>
> <int name="u_reviewdate:[NOW-2YEAR TO NOW-1YEAR]">3017</int>
> <int name="u_reviewdate:[NOW-5YEAR TO NOW-2YEAR]">1538</int>
> <int name="u_reviewdate:[NOW-100YEAR TO NOW-5YEAR]">47</int>
> </lst>
> <lst name="facet_fields">
> <lst name="u_idx">
> <int name="section">39663</int>
> <int name="adam">6211</int>
> <int name="image">3840</int>
> <int name="slideshow">2480</int>
> </lst>
> {quote}
> I believe this is because of the use of NamedList for this data structure in
> FacetCountsComponent, SimpleOrderedMap should be used instead. This will
> produce results of facet_field counts like a map in JSON format (and keep the
> XML output the same).
> {quote}
> "facet_counts":{
> "facet_fields":{
> "u_idx":[
> "section":39663,
> "adam":6211,
> "image":3840,
> "slideshow":2480],
> ...
> {quote}
> This makes it consistent across different kinds of facets and is easier to
> consume on the client.
> There is the concern about backward compatibility (ie users are already
> consuming the incorrect/inconsistent format so we can't change it), but if
> that is not as important as consistency and ease of use, then I can supply a
> patch for this.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]