You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Munendra S N (JIRA)" <ji...@apache.org> on 2019/03/18 16:49:00 UTC

[jira] [Commented] (SOLR-7530) Wrong JSON response using Terms Component with distrib=true

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

Munendra S N commented on SOLR-7530:
------------------------------------

Facing same issue
On debugging, found that the difference in response format is due how *SimpleOrderedMap* and *NamedList* are handled in JSONResponseWriter. This issue occurs only with *wt=json*
* In single shard/stand alone mode, terms are accumulated in NamedList and returned. In multiSharding, while handling shardResponses SimpleOrderedMap is used to accumulate terms and counts
{code:java}
https://github.com/apache/lucene-solr/blob/master/solr/core/src/java/org/apache/solr/handler/component/TermsComponent.java#L191
{code}
{code:java}
https://github.com/apache/lucene-solr/blob/master/solr/core/src/java/org/apache/solr/handler/component/TermsComponent.java#L557
{code}

* Also, response formats are different when  terms list specified and when no terms list is specified. This is also due to  difference SimpleOrderedMap vs NamedList handling

h6. Probable Solutions:
* Instead of NamedList, use SimpleOrderedMap. Problem is that it won't be backward compatible. Also, facet response and terms response would be different. SOLR-1845
* Use of NamedList in place of SimpleOrderedMap. If I'm not wrong, SimpleOrderedMap is preferred over NamedList in recent times. This would be step backward but will solve this issue

Let me know what would be best approach to handle this. I'm willing to raise a patch for this


> Wrong JSON response using Terms Component with distrib=true
> -----------------------------------------------------------
>
>                 Key: SOLR-7530
>                 URL: https://issues.apache.org/jira/browse/SOLR-7530
>             Project: Solr
>          Issue Type: Bug
>          Components: Response Writers, SearchComponents - other, SolrCloud
>    Affects Versions: 4.9
>            Reporter: Raúl Grande
>            Priority: Major
>
> When using TermsComponent in SolrCloud there are differences in the JSON response if parameter distrib is true or false. If distrib=true JSON is not well formed (please note at the [ ] marks)
> JSON Response when distrib=false. Correct response:
> {"responseHeader":{ 
> 		"status":0, 
> 		"QTime":3
> }, 
> "terms":{ 
> "FileType":
> [ 
> 			"EMAIL",20060, 
> 			"PDF",7051, 
> 			"IMAGE",5108, 
> 			"OFFICE",4912, 
> 			"TXT",4405, 
> 			"OFFICE_EXCEL",4122, 
> 			"OFFICE_WORD",2468
> 		]
> } } 
> JSON Response when distrib=true. Incorrect response:
> { 
> "responseHeader":{
> 		"status":0, 
> 		"QTime":94
> }, 
> "terms":{ 
> "FileType":{ 
> 			"EMAIL":31923, 
> 			"PDF":11545, 
> 			"IMAGE":9807, 
> 			"OFFICE_EXCEL":8195, 
> 			"OFFICE":5147, 
> 			"OFFICE_WORD":4820, 
> 			"TIFF":1156, 
> 			"XML":851, 
> 			"HTML":821, 
> 			"RTF":303
> 		} 
> } } 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org