java.lang.Object
org.apache.lucene.facet.FacetsCollectorManager
- All Implemented Interfaces:
CollectorManager<FacetsCollector,FacetsCollector>
public class FacetsCollectorManager
extends Object
implements CollectorManager<FacetsCollector,FacetsCollector>
A
CollectorManager implementation which produces FacetsCollector and produces a merged
FacetsCollector. This is used for concurrent FacetsCollection.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordHolds results of a search run via static utility methods exposed by this class.private static class -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSole constructor.FacetsCollectorManager(boolean keepScores) Creates a new collector manager that in turn createsFacetsCollectorusing the providedkeepScoresflag. -
Method Summary
Modifier and TypeMethodDescriptionprivate static FacetsCollectorManager.FacetsResultdoSearch(IndexSearcher searcher, ScoreDoc after, Query q, int n, Sort sort, boolean doDocScores, FacetsCollectorManager fcm) private static FacetsCollector.MatchingDocsmerge(FacetsCollector.MatchingDocs matchingDocs1, FacetsCollector.MatchingDocs matchingDocs2) Return a newCollector.reduce(Collection<FacetsCollector> collectors) Reduce the results of individual collectors into a meaningful result.(package private) static Collection<FacetsCollector.MatchingDocs> reduceMatchingDocs(Collection<? extends FacetsCollector> facetsCollectors) Reduces matching docs held by the provided facets collectors, merging matching docs for the same leaf into a single matching docs instancesearch(IndexSearcher searcher, Query q, int n, FacetsCollectorManager fcm) Utility method, to search and also populate aFacetsCollectorwith hits.search(IndexSearcher searcher, Query q, int n, Sort sort, boolean doDocScores, FacetsCollectorManager fcm) Utility method, to search and also populate aFacetsCollectorwith hits.search(IndexSearcher searcher, Query q, int n, Sort sort, FacetsCollectorManager fcm) Utility method, to search and also populate aFacetsCollectorwith hits.searchAfter(IndexSearcher searcher, ScoreDoc after, Query q, int n, FacetsCollectorManager fcm) Utility method, to search and also populate aFacetsCollectorwith hits.searchAfter(IndexSearcher searcher, ScoreDoc after, Query q, int n, Sort sort, boolean doDocScores, FacetsCollectorManager fcm) Utility method, to search and also populate aFacetsCollectorwith hits.searchAfter(IndexSearcher searcher, ScoreDoc after, Query q, int n, Sort sort, FacetsCollectorManager fcm) Utility method, to search and also populate aFacetsCollectorwith hits.
-
Field Details
-
keepScores
private final boolean keepScores
-
-
Constructor Details
-
FacetsCollectorManager
public FacetsCollectorManager()Sole constructor. -
FacetsCollectorManager
public FacetsCollectorManager(boolean keepScores) Creates a new collector manager that in turn createsFacetsCollectorusing the providedkeepScoresflag. hits.
-
-
Method Details
-
newCollector
Description copied from interface:CollectorManagerReturn a newCollector. This must return a different instance on each call.- Specified by:
newCollectorin interfaceCollectorManager<FacetsCollector,FacetsCollector> - Throws:
IOException
-
reduce
Description copied from interface:CollectorManagerReduce the results of individual collectors into a meaningful result. For instance aTopDocsCollectorwould compute thetop docsof each collector and then merge them usingTopDocs.merge(int, TopDocs[]). This method must be called after collection is finished on all provided collectors.- Specified by:
reducein interfaceCollectorManager<FacetsCollector,FacetsCollector> - Throws:
IOException
-
reduceMatchingDocs
static Collection<FacetsCollector.MatchingDocs> reduceMatchingDocs(Collection<? extends FacetsCollector> facetsCollectors) Reduces matching docs held by the provided facets collectors, merging matching docs for the same leaf into a single matching docs instance- Parameters:
facetsCollectors- the facets collectors- Returns:
- the reduced matching docs, with one instance per leaf reader context
-
merge
private static FacetsCollector.MatchingDocs merge(FacetsCollector.MatchingDocs matchingDocs1, FacetsCollector.MatchingDocs matchingDocs2) -
search
public static FacetsCollectorManager.FacetsResult search(IndexSearcher searcher, Query q, int n, FacetsCollectorManager fcm) throws IOException Utility method, to search and also populate aFacetsCollectorwith hits. The providedFacetsCollectorManagerwill be used for creating/reducingFacetsCollectorinstances.- Throws:
IOException
-
search
public static FacetsCollectorManager.FacetsResult search(IndexSearcher searcher, Query q, int n, Sort sort, FacetsCollectorManager fcm) throws IOException Utility method, to search and also populate aFacetsCollectorwith hits. The providedFacetsCollectorManagerwill be used for creating/reducingFacetsCollectorinstances.- Throws:
IOException
-
search
public static FacetsCollectorManager.FacetsResult search(IndexSearcher searcher, Query q, int n, Sort sort, boolean doDocScores, FacetsCollectorManager fcm) throws IOException Utility method, to search and also populate aFacetsCollectorwith hits. The providedFacetsCollectorManagerwill be used for creating/reducingFacetsCollectorinstances.- Throws:
IOException
-
searchAfter
public static FacetsCollectorManager.FacetsResult searchAfter(IndexSearcher searcher, ScoreDoc after, Query q, int n, FacetsCollectorManager fcm) throws IOException Utility method, to search and also populate aFacetsCollectorwith hits. The providedFacetsCollectorManagerwill be used for creating/reducingFacetsCollectorinstances.- Throws:
IOException
-
searchAfter
public static FacetsCollectorManager.FacetsResult searchAfter(IndexSearcher searcher, ScoreDoc after, Query q, int n, Sort sort, FacetsCollectorManager fcm) throws IOException Utility method, to search and also populate aFacetsCollectorwith hits. The providedFacetsCollectorManagerwill be used for creating/reducingFacetsCollectorinstances.- Throws:
IOException
-
searchAfter
public static FacetsCollectorManager.FacetsResult searchAfter(IndexSearcher searcher, ScoreDoc after, Query q, int n, Sort sort, boolean doDocScores, FacetsCollectorManager fcm) throws IOException Utility method, to search and also populate aFacetsCollectorwith hits. The providedFacetsCollectorManagerwill be used for creating/reducingFacetsCollectorinstances.- Throws:
IOException
-
doSearch
private static FacetsCollectorManager.FacetsResult doSearch(IndexSearcher searcher, ScoreDoc after, Query q, int n, Sort sort, boolean doDocScores, FacetsCollectorManager fcm) throws IOException - Throws:
IOException
-