You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by jefferyyuan <yu...@gmail.com> on 2012/12/27 03:18:54 UTC
Re: How to modify Solr StatsComponent to support stats.query
Found the way to do this:
I changed code of
org.apache.solr.handler.component.SimpleStats.getStatsFields() like below:
String[] queriesStr = params.getFieldParams(f, "stats.query");
if (queriesStr != null && queriesStr.length > 0) {
for (String queryStr : queriesStr) {
QParser qparser = QParser.getParser(queriesStr, "lucene", req);
SolrQueryParser parser = new SolrQueryParser(qparser, req
.getSchema().getDefaultSearchFieldName());
Query query = parser.parse(queriesStr);
DocSet docSet = searcher.getDocSet(query);
DocSet interSection = docs.intersection(docSet);
NamedList<?> stv = (NamedList<?>) uif.getStats(searcher,docs,
facets).getStatsValues();
}
}
--
View this message in context: http://lucene.472066.n3.nabble.com/How-to-modify-Solr-StatsComponent-to-support-stats-query-tp4028991p4029244.html
Sent from the Solr - User mailing list archive at Nabble.com.