org.apache.solr.analytics.request.AnalyticsStats Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of solr-analytics Show documentation
Show all versions of solr-analytics Show documentation
Apache Solr Content Analytics Package
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.solr.analytics.request;
import java.io.IOException;
import java.lang.invoke.MethodHandles;
import java.util.List;
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.search.DocIdSet;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.solr.analytics.accumulator.BasicAccumulator;
import org.apache.solr.analytics.accumulator.FacetingAccumulator;
import org.apache.solr.analytics.accumulator.ValueAccumulator;
import org.apache.solr.analytics.plugin.AnalyticsStatisticsCollector;
import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.search.DocSet;
import org.apache.solr.search.Filter;
import org.apache.solr.search.SolrIndexSearcher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Class which computes the set of {@link AnalyticsRequest}s.
*/
public class AnalyticsStats {
protected DocSet docs;
protected SolrParams params;
protected SolrIndexSearcher searcher;
protected SolrQueryRequest req;
protected AnalyticsStatisticsCollector statsCollector;
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
public AnalyticsStats(SolrQueryRequest req, DocSet docs, SolrParams params, AnalyticsStatisticsCollector statsCollector) {
this.req = req;
this.searcher = req.getSearcher();
this.docs = docs;
this.params = params;
this.statsCollector = statsCollector;
}
/**
* Calculates the analytics requested in the Parameters.
*
* @return List of results formated to mirror the input XML.
* @throws IOException if execution fails
*/
public NamedList> execute() throws IOException {
statsCollector.startRequest();
NamedList
© 2015 - 2025 Weber Informatics LLC | Privacy Policy