String[] components = FacetsConfig.stringToPath(term.utf8ToString()); if (components.length != 2) { throw new IllegalArgumentException("this class can only handle 2 level hierarchy (dim/value); got: " + Arrays.toString(components) + " " + term.utf8ToString());
@Override public FacetLabel getPath(int ordinal) throws IOException { ensureOpen(); // Since the cache is shared with DTR instances allocated from // doOpenIfChanged, we need to ensure that the ordinal is one that this DTR // instance recognizes. Therefore we do this check up front, before we hit // the cache. if (ordinal < 0 || ordinal >= indexReader.maxDoc()) { return null; } // TODO: can we use an int-based hash impl, such as IntToObjectMap, // wrapped as LRU? Integer catIDInteger = Integer.valueOf(ordinal); synchronized (categoryCache) { FacetLabel res = categoryCache.get(catIDInteger); if (res != null) { return res; } } Document doc = indexReader.document(ordinal); FacetLabel ret = new FacetLabel(FacetsConfig.stringToPath(doc.get(Consts.FULL))); synchronized (categoryCache) { categoryCache.put(catIDInteger, ret); } return ret; }
String[] components = FacetsConfig.stringToPath(term.utf8ToString()); if (components.length != 2) { throw new IllegalArgumentException("this class can only handle 2 level hierarchy (dim/value); got: " + Arrays.toString(components) + " " + term.utf8ToString());
@Override public FacetLabel getPath(int ordinal) throws IOException { ensureOpen(); // Since the cache is shared with DTR instances allocated from // doOpenIfChanged, we need to ensure that the ordinal is one that this DTR // instance recognizes. Therefore we do this check up front, before we hit // the cache. if (ordinal < 0 || ordinal >= indexReader.maxDoc()) { return null; } // TODO: can we use an int-based hash impl, such as IntToObjectMap, // wrapped as LRU? Integer catIDInteger = Integer.valueOf(ordinal); synchronized (categoryCache) { FacetLabel res = categoryCache.get(catIDInteger); if (res != null) { return res; } } Document doc = indexReader.document(ordinal); FacetLabel ret = new FacetLabel(FacetsConfig.stringToPath(doc.get(Consts.FULL))); synchronized (categoryCache) { categoryCache.put(catIDInteger, ret); } return ret; }
&& field instanceof SortedSetDocValuesField ) { String[] facetParts = FacetsConfig.stringToPath( field.binaryValue().utf8ToString() ); if ( facetParts == null || facetParts.length != 2 ) { continue;
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(); } } }
TopOrdAndIntQueue.OrdAndValue ordAndValue = q.pop(); final BytesRef term = dv.lookupOrd(ordAndValue.ord); String[] parts = FacetsConfig.stringToPath(term.utf8ToString()); labelValues[i] = new LabelAndValue(parts[1], ordAndValue.value);
FacetLabel cp = new FacetLabel(FacetsConfig.stringToPath(te.term().utf8ToString())); final int ordinal = addCategory(cp); docs = te.postings(docs, PostingsEnum.NONE);
TopOrdAndIntQueue.OrdAndValue ordAndValue = q.pop(); final BytesRef term = dv.lookupOrd(ordAndValue.ord); String[] parts = FacetsConfig.stringToPath(term.utf8ToString()); labelValues[i] = new LabelAndValue(parts[1], ordAndValue.value);
FacetLabel cp = new FacetLabel(FacetsConfig.stringToPath(te.term().utf8ToString())); final int ordinal = addCategory(cp); docs = te.postings(docs, PostingsEnum.NONE);
FacetLabel cp = new FacetLabel(FacetsConfig.stringToPath(t.utf8ToString())); postingsEnum = termsEnum.postings(postingsEnum, PostingsEnum.NONE); boolean res = cache.put(cp, postingsEnum.nextDoc() + ctx.docBase);
FacetLabel cp = new FacetLabel(FacetsConfig.stringToPath(t.utf8ToString())); postingsEnum = termsEnum.postings(postingsEnum, PostingsEnum.NONE); boolean res = cache.put(cp, postingsEnum.nextDoc() + ctx.docBase);
TopOrdAndIntQueue.OrdAndValue ordAndValue = q.pop(); final BytesRef term = dv.lookupOrd(ordAndValue.ord); String[] parts = FacetsConfig.stringToPath(term.utf8ToString()); labelValues[i] = new LabelAndValue(parts[1], ordAndValue.value);