You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "yuanyun.cn (JIRA)" <ji...@apache.org> on 2012/12/24 05:26:15 UTC

[jira] [Comment Edited] (SOLR-2976) stats.facet no longer works on single valued trie fields that don't use precision step

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

yuanyun.cn edited comment on SOLR-2976 at 12/24/12 4:25 AM:
------------------------------------------------------------

I changed the date type to precisionStep="2147483647", and run stats.facet search, it still failed with the following exception:
SEVERE: org.apache.solr.common.SolrException: Invalid Date String:''
        at org.apache.solr.schema.DateField.parseMath
        at org.apache.solr.schema.TrieField.readableToIndexed
        at org.apache.solr.schema.TrieField.readableToIndexed
        at org.apache.solr.schema.TrieField.toInternal
        at org.apache.solr.schema.TrieDateField.toInternal
        at org.apache.solr.request.UnInvertedField.getStats
        at org.apache.solr.handler.component.SimpleStats.getStatsFields
        at org.apache.solr.handler.component.SimpleStats.getStatsCounts
        at org.apache.solr.handler.component.StatsComponent.process(
    if (finfo.length > 0) {
      for (FieldFacetStats f : finfo) {
        Map<String,StatsValues> facetStatsValues = f.facetStatsValues;
        FieldType facetType = searcher.getSchema().getFieldType(f.name);
        for (Map.Entry<String,StatsValues> entry : facetStatsValues.entrySet()) {
          String termLabel = entry.getKey();
          int missingCount = searcher.numDocs(new TermQuery(new Term(f.name,
              facetType.toInternal(termLabel))), missing); /// It failed at here.
          entry.getValue().addMissing(missingCount);
        }
        allstats.addFacet(f.name, facetStatsValues);
      }
    }
After I comment the code to compute missing field, and :rerun the stats.facet query, the response is like this: - all value in accessTime is thought as \#8;
<lst name="facets">
	<lst name="accessTime">
		<lst name="\#8;">
			<double name="min">0.0</double>
			<double name="max">4.1875931136E10</double>
			<long name="count">999999</long>
			<long name="missing">0</long>
			<double name="sum">1.591718017629E12</double>
			<double name="sumOfSquares">6.98855105273788E21</double>
			<double name="mean">1591719.6093486093</double>
			<double name="stddev">8.358248294959643E7</double>
			<lst name="facets"/>
		</lst>
	</lst>
</lst>

Same problem for TrieLong(Int) fields.
Can anyone please tell me how to fix this problem, so stats,facet query can work on TrieDate(Long,Int) fields.

Thanks very much, and Merry Christmas :) 
                
      was (Author: yuanyun.cn):
    I changed the date type to precisionStep="2147483647", and run stats.facet search, it still failed with the following exception:
SEVERE: org.apache.solr.common.SolrException: Invalid Date String:''
        at org.apache.solr.schema.DateField.parseMath
        at org.apache.solr.schema.TrieField.readableToIndexed
        at org.apache.solr.schema.TrieField.readableToIndexed
        at org.apache.solr.schema.TrieField.toInternal
        at org.apache.solr.schema.TrieDateField.toInternal
        at org.apache.solr.request.UnInvertedField.getStats
        at org.apache.solr.handler.component.SimpleStats.getStatsFields
        at org.apache.solr.handler.component.SimpleStats.getStatsCounts
        at org.apache.solr.handler.component.StatsComponent.process(
    if (finfo.length > 0) {
      for (FieldFacetStats f : finfo) {
        Map<String,StatsValues> facetStatsValues = f.facetStatsValues;
        FieldType facetType = searcher.getSchema().getFieldType(f.name);
        for (Map.Entry<String,StatsValues> entry : facetStatsValues.entrySet()) {
          String termLabel = entry.getKey();
          int missingCount = searcher.numDocs(new TermQuery(new Term(f.name,
              facetType.toInternal(termLabel))), missing); /// It failed at here.
          entry.getValue().addMissing(missingCount);
        }
        allstats.addFacet(f.name, facetStatsValues);
      }
    }
After I comment the code to compute missing field, and :rerun the stats.facet query, the response is like this: - all value in accessTime is thought as \#8;
<lst name="facets">
	<lst name="accessTime">
		<lst name="\#8;">
			<double name="min">0.0</double>
			<double name="max">4.1875931136E10</double>
			<long name="count">999999</long>
			<long name="missing">0</long>
			<double name="sum">1.591718017629E12</double>
			<double name="sumOfSquares">6.98855105273788E21</double>
			<double name="mean">1591719.6093486093</double>
			<double name="stddev">8.358248294959643E7</double>
			<lst name="facets"/>
		</lst>
	</lst>
</lst>

Same problem for TrieLong(Int) fields.
Can anyone please tell me how to fix this problem, so stats,facet query can work on TrieDate(Long,Int) fields.

Thanks very much, and Merry Christmas :) 
                  
> stats.facet no longer works on single valued trie fields that don't use precision step
> --------------------------------------------------------------------------------------
>
>                 Key: SOLR-2976
>                 URL: https://issues.apache.org/jira/browse/SOLR-2976
>             Project: Solr
>          Issue Type: Bug
>    Affects Versions: 3.5
>            Reporter: Hoss Man
>         Attachments: SOLR-2976_3.4_test.patch, SOLR-2976.patch
>
>
> As reported on the mailing list, 3.5 introduced a regression that prevents single valued Trie fields that don't use precision steps (to add course grained terms) from being used in stats.facet.
> two immediately obvious problems...
> 1) in 3.5 the stats component is checking if isTokenzed() is true for the field type (which is probably wise) but regardless of the precisionStep used, TrieField.isTokenized is hardcoded to return true
> 2) the 3.5 stats faceting will fail if the FieldType is multivalued - it doesn't check if the SchemaField is configured to be single valued (overriding the FieldType)
> so even if a user has something like this in their schema...
> {code}
> <fieldType name="long" class="solr.TrieLongField" precisionStep="0" omitNorms="true" />
> <field name="ts" type="long" indexed="true" stored="true" required="true" multiValued="false" />
> {code}
> ...stats.facet will not work.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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