/** Sparse faceting: returns any dimension that had any * hits, topCount labels per dimension. */ public SortedSetDocValuesFacetCounts(SortedSetDocValuesReaderState state, FacetsCollector hits) throws IOException { this.state = state; this.field = state.getField(); dv = state.getDocValues(); counts = new int[state.getSize()]; //System.out.println("field=" + field); count(hits.getMatchingDocs()); }
/** Counts all facet dimensions across the provided hits. */ public SortedSetDocValuesFacetCounts(SortedSetDocValuesReaderState state, FacetsCollector hits) throws IOException { this.state = state; this.field = state.getField(); dv = state.getDocValues(); counts = new int[state.getSize()]; if (hits == null) { // browse only countAll(); } else { count(hits.getMatchingDocs()); } }
/** Counts all facet dimensions across the provided hits. */ public ConcurrentSortedSetDocValuesFacetCounts(SortedSetDocValuesReaderState state, FacetsCollector hits, ExecutorService exec) throws IOException, InterruptedException { this.state = state; this.field = state.getField(); this.exec = exec; dv = state.getDocValues(); counts = new AtomicIntegerArray(state.getSize()); if (hits == null) { // browse only countAll(); } else { count(hits.getMatchingDocs()); } }
private void filterFacet(int docId) throws IOException { Document document = reader.document(docId); // filter using doc values (avoiding requiring stored values) if (!filter.isAccessible(document.getField(FieldNames.PATH).stringValue() + "/" + dimension)) { SortedSetDocValues docValues = state.getDocValues(); docValues.setDocument(docId); TermsEnum termsEnum = docValues.termsEnum(); long ord = docValues.nextOrd(); while (ord != SortedSetDocValues.NO_MORE_ORDS) { termsEnum.seekExact(ord); String facetDVTerm = termsEnum.term().utf8ToString(); String [] facetDVDimPaths = FacetsConfig.stringToPath(facetDVTerm); // first element is dimention name for (int i = 1; i < facetDVDimPaths.length; i++) { markInaccessbile(facetDVDimPaths[i]); } ord = docValues.nextOrd(); } } }
private void filterFacet(int docId) throws IOException { Document document = reader.document(docId); // filter using doc values (avoiding requiring stored values) if (!filter.isAccessible(document.getField(FieldNames.PATH).stringValue() + "/" + dimension)) { SortedSetDocValues docValues = state.getDocValues(); docValues.setDocument(docId); TermsEnum termsEnum = docValues.termsEnum(); long ord = docValues.nextOrd(); while (ord != SortedSetDocValues.NO_MORE_ORDS) { termsEnum.seekExact(ord); String facetDVTerm = termsEnum.term().utf8ToString(); String [] facetDVDimPaths = FacetsConfig.stringToPath(facetDVTerm); // first element is dimention name for (int i = 1; i < facetDVDimPaths.length; i++) { markInaccessbile(facetDVDimPaths[i]); } ord = docValues.nextOrd(); } } }