You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Cassandra Targett (JIRA)" <ji...@apache.org> on 2018/01/09 21:13:00 UTC

[jira] [Resolved] (SOLR-4240) Stats response always shows one extra empty facets element in Solr 4.0.

     [ https://issues.apache.org/jira/browse/SOLR-4240?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Cassandra Targett resolved SOLR-4240.
-------------------------------------
       Resolution: Fixed
    Fix Version/s:     (was: 6.0)
                       (was: 4.9)
                   5.1

The suggested code change appears to have been made as part of SOLR-6349, and I cannot reproduce this output with 7.2, so I believe this was fixed circa Solr 5.1.

> Stats response always shows one extra empty facets element in Solr 4.0. 
> ------------------------------------------------------------------------
>
>                 Key: SOLR-4240
>                 URL: https://issues.apache.org/jira/browse/SOLR-4240
>             Project: Solr
>          Issue Type: Bug
>          Components: SearchComponents - other
>            Reporter: jefferyyuan
>            Priority: Minor
>              Labels: stats, statscomponent
>             Fix For: 5.1
>
>
> If I don't specify stats.facet, it still shows one extra facets element. 
> http://localhost:8888/solr/select?q=*:*&rows=0&stats=true&stats.field=szkb
> {code:xml} 
> <lst name="stats">
> 	<lst name="stats_fields">
> 		<lst name="szkb">
> 			<double name="min">1.0</double>
> 			<double name="max">3.0</double>
> 			<long name="count">4980</long>
> 			<long name="missing">0</long>
> 			<double name="sum">10369.0</double>
> 			<double name="sumOfSquares">22637.0</double>
> 			<double name="mean">2.082128514056225</double>
> 			<double name="stddev">0.4586561046404609</double>
> 			<lst name="facets"/> ===> extra facets elment
> 		</lst>
> 	</lst>
> </lst>
> {code} 
> If I specify stats.facet, then for each facet value, it shows one extra facets element. 
> http://localhost:8888/solr/select?q=*:*&rows=0&stats=true&stats.field=szkb&stats.facet=filetype
> {code:xml} 
> <lst name="facets">
> 	<lst name="filetype">
> 		<lst name="ppt">
> 			<double name="min">1.0</double>
> 			<double name="max">1.0</double>
> 			<long name="count">1</long>
> 			<long name="missing">0</long>
> 			<double name="sum">1.0</double>
> 			<double name="sumOfSquares">1.0</double>
> 			<double name="mean">1.0</double>
> 			<double name="stddev">0.0</double>
> 			<lst name="facets"/> ===> extra facets elment, this is bad.
> 		</lst>
> 	</lst>
> </lst>
> {code} 
> The empty facets elment is no use, and annoying.
> The culprit is the code:
> org.apache.solr.handler.component.AbstractStatsValues.getStatsValues()
> {code:title=StatsValuesFactory.java|borderStyle=solid}
> public NamedList<?> getStatsValues() {
>  // add the facet stats
>  ===> Here it always adds facets, in stead, it should check whether it is empty: if (!facets.isEmpty())
> NamedList<NamedList<?>> nl = new SimpleOrderedMap<NamedList<?>>();
> for (Map.Entry<String, Map<String, StatsValues>> entry : facets.entrySet()) {
>   NamedList<NamedList<?>> nl2 = new SimpleOrderedMap<NamedList<?>>();
>   nl.add(entry.getKey(), nl2);
>   for (Map.Entry<String, StatsValues> e2 : entry.getValue().entrySet()) {
> 	nl2.add(e2.getKey(), e2.getValue().getStatsValues());
>   }
> }
> res.add(FACETS, nl);
> return res;
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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