/** * Creates a new {@code FacetQuery} filtering the query on the given dimension. */ public FacetQuery(final FacetsConfig facetsConfig, final String dimension, final String... path) { super(toTerm(facetsConfig.getDimConfig(dimension), dimension, path)); }
/** * Creates a new {@code MultiFacetQuery} filtering the query on the given dimension. */ public MultiFacetQuery(final FacetsConfig facetsConfig, final String dimension, final String[]... paths) { super(facetsConfig.getDimConfig(dimension).indexFieldName, toTerms(dimension, paths)); }
/** Counts all facet values for the provided {@link LongValuesSource}. This produces the same result as computing * facets on a {@link org.apache.lucene.search.MatchAllDocsQuery}, but is more efficient. */ public LongValueFacetCounts(String field, LongValuesSource valueSource, IndexReader reader) throws IOException { this.field = field; countAll(valueSource, field, reader); }
/** Empty constructor */ public AssociationsFacetsExample() { config = new FacetsConfig(); config.setMultiValued("tags", true); config.setIndexFieldName("tags", "$tags"); config.setMultiValued("genre", true); config.setIndexFieldName("genre", "$genre"); }
/** Adds one dimension of drill downs; if you pass the same * dimension more than once it is OR'd with the previous * cofnstraints on that dimension, and all dimensions are * AND'd against each other and the base query. */ public void add(String dim, String... path) { String indexedField = config.getDimConfig(dim).indexFieldName; add(dim, new TermQuery(term(indexedField, dim, path))); }
/** * Translates any added {@link FacetField}s into normal fields for indexing; * only use this version if you did not add any taxonomy-based fields ( * {@link FacetField} or {@link AssociationFacetField}). * * <p> * <b>NOTE:</b> you should add the returned document to IndexWriter, not the * input one! */ public Document build(Document doc) throws IOException { return build(null, doc); }
/** Creates a new instance and populates the category list params mapping. */ public MultiCategoryListsFacetsExample() { config.setIndexFieldName("Author", "author"); config.setIndexFieldName("Publish Date", "pubdate"); config.setHierarchical("Publish Date", true); }
public void enableFacetProcessing() { if ( facetConfig == null ) { facetConfig = new FacetsConfig(); } }
/** * Search, sorting by score, and computing * drill down and sideways counts. */ public DrillSidewaysResult search(DrillDownQuery query, int topN) throws IOException { return search(null, query, topN); }
/** Utility method, to search and also collect all hits * into the provided {@link Collector}. */ public static TopDocs searchAfter(IndexSearcher searcher, ScoreDoc after, Query q, int n, Collector fc) throws IOException { return doSearch(searcher, after, q, n, null, false, false, fc); }
/** Sole constructor. */ public SortedSetDocValuesFacetField(String dim, String label) { super("dummy", TYPE); FacetField.verifyLabel(label); FacetField.verifyLabel(dim); this.dim = dim; this.label = label; }
/** Get the next random int, between 0 (inclusive) and n (exclusive) */ public int nextInt(int n) { int res = (int) (randomLong() % n); return (res < 0) ? -res : res; }
/** * Creates a new {@code FacetQuery} filtering the query on the given dimension. * <p> * <b>NOTE:</b>Uses FacetsConfig.DEFAULT_DIM_CONFIG. */ public FacetQuery(final String dimension, final String... path) { super(toTerm(FacetsConfig.DEFAULT_DIM_CONFIG, dimension, path)); }
/** * Creates a new {@code MultiFacetQuery} filtering the query on the given dimension. * <p> * <b>NOTE:</b>Uses FacetsConfig.DEFAULT_DIM_CONFIG. */ public MultiFacetQuery(final String dimension, final String[]... paths) { super(FacetsConfig.DEFAULT_DIM_CONFIG.indexFieldName, toTerms(dimension, paths)); }
/** * Search, sorting by score, and computing * drill down and sideways counts. */ public DrillSidewaysResult search(DrillDownQuery query, int topN) throws IOException { return search(null, query, topN); }
/** Utility method, to search and also collect all hits * into the provided {@link Collector}. */ public static TopDocs search(IndexSearcher searcher, Query q, int n, Collector fc) throws IOException { return doSearch(searcher, null, q, n, null, false, false, fc); }
/** Sole constructor. */ public SortedSetDocValuesFacetField(String dim, String label) { super("dummy", TYPE); FacetField.verifyLabel(label); FacetField.verifyLabel(dim); this.dim = dim; this.label = label; }
/** Get the next random int, between 0 (inclusive) and n (exclusive) */ public int nextInt(int n) { int res = (int) (randomLong() % n); return (res < 0) ? -res : res; }
/** Utility method, to search and also collect all hits * into the provided {@link Collector}. */ public static TopDocs search(IndexSearcher searcher, Query q, int n, Collector fc) throws IOException { return doSearch(searcher, null, q, n, null, false, false, fc); }
/** Utility method, to search and also collect all hits * into the provided {@link Collector}. */ public static TopDocs searchAfter(IndexSearcher searcher, ScoreDoc after, Query q, int n, Collector fc) throws IOException { return doSearch(searcher, after, q, n, null, false, false, fc); }