Example usage for org.apache.solr.search DocSet getTopFilter

List of usage examples for org.apache.solr.search DocSet getTopFilter

Introduction

In this page you can find the example usage for org.apache.solr.search DocSet getTopFilter.

Prototype

public Filter getTopFilter();

Source Link

Document

Returns a Filter for use in Lucene search methods, assuming this DocSet was generated from the top-level MultiReader that the Lucene search methods will be invoked with.

Usage

From source file:org.alfresco.solr.query.SolrCachingPathQuery.java

License:Open Source License

public Weight createWeight(IndexSearcher indexSearcher, boolean requiresScore) throws IOException {
    SolrIndexSearcher searcher = null;/* w w  w  . ja  v a 2s  .c o m*/
    if (!(indexSearcher instanceof SolrIndexSearcher)) {
        throw new IllegalStateException("Must have a SolrIndexSearcher");
    } else {
        searcher = (SolrIndexSearcher) indexSearcher;
    }

    DocSet results = (DocSet) searcher.cacheLookup(CacheConstants.ALFRESCO_PATH_CACHE, pathQuery);
    if (results == null) {
        // Cache miss: get path query results and cache them
        WrappedQuery wrapped = new WrappedQuery(pathQuery);
        wrapped.setCache(false);
        results = searcher.getDocSet(wrapped);
        searcher.cacheInsert(CacheConstants.ALFRESCO_PATH_CACHE, pathQuery, results);
    }

    return new ConstantScoreQuery(results.getTopFilter()).createWeight(searcher, false);
}

From source file:org.tallison.solr.search.concordance.SolrConcordanceBase.java

License:Apache License

public static Filter getFilterQuery(Query q, SolrQueryRequest req) throws Exception {
    DocSet docs = getDocSet(q, req);
    if (docs != null && !docs.equals(DocSet.EMPTY)) {
        return docs.getTopFilter();
    }//w ww  .j  a v a  2 s .  c o  m
    return null;
}