/** Turns a dim + path into an encoded string. */ public static String pathToString(String[] path) { return pathToString(path, path.length); }
/** Turns a dim + path into an encoded string. */ public static String pathToString(String[] path) { return pathToString(path, path.length); }
/** Turns a dim + path into an encoded string. */ public static String pathToString(String dim, String[] path) { String[] fullPath = new String[1+path.length]; fullPath[0] = dim; System.arraycopy(path, 0, fullPath, 1, path.length); return pathToString(fullPath, fullPath.length); }
/** Turns a dim + path into an encoded string. */ public static String pathToString(String dim, String[] path) { String[] fullPath = new String[1+path.length]; fullPath[0] = dim; System.arraycopy(path, 0, fullPath, 1, path.length); return pathToString(fullPath, fullPath.length); }
/** Creates a drill-down term. */ public static Term term(String field, String dim, String... path) { return new Term(field, FacetsConfig.pathToString(dim, path)); }
static Term toTerm(final FacetsConfig.DimConfig dimConfig, final String dimension, final String... path) { return new Term(dimConfig.indexFieldName, FacetsConfig.pathToString(dimension, path)); } }
/** Creates a drill-down term. */ public static Term term(String field, String dim, String... path) { return new Term(field, FacetsConfig.pathToString(dim, path)); }
static Collection<BytesRef> toTerms(final String dimension, final String[]... paths) { final Collection<BytesRef> terms = new ArrayList<>(paths.length); for (String[] path : paths) terms.add(new BytesRef(FacetsConfig.pathToString(dimension, path))); return terms; }
@Override public Number getSpecificValue(String dim, String... path) { if (path.length != 1) { throw new IllegalArgumentException("path must be length=1"); } int ord = (int) dv.lookupTerm(new BytesRef(FacetsConfig.pathToString(dim, path))); if (ord < 0) { return -1; } return counts[ord]; }
@Override public Number getSpecificValue(String dim, String... path) throws IOException { if (path.length != 1) { throw new IllegalArgumentException("path must be length=1"); } int ord = (int) dv.lookupTerm(new BytesRef(FacetsConfig.pathToString(dim, path))); if (ord < 0) { return -1; } return counts[ord]; }
@Override final public Query getQuery(final QueryContext queryContext) throws IOException { Objects.requireNonNull(dimension, "The dimension is missing"); final FieldMap fieldMap = queryContext.getFieldMap(); final String resolvedDimension = fieldMap == null ? dimension : fieldMap.resolveQueryFieldName(genericField, dimension); final String indexFieldName = queryContext.getFacetsConfig(genericField, dimension).getDimConfig(resolvedDimension).indexFieldName; final Term term = new Term(indexFieldName, FacetsConfig.pathToString(resolvedDimension, path)); return new org.apache.lucene.search.TermQuery(term); }
@Override public Number getSpecificValue(String dim, String... path) throws IOException { if (path.length != 1) { throw new IllegalArgumentException("path must be length=1"); } int ord = (int) dv.lookupTerm(new BytesRef(FacetsConfig.pathToString(dim, path))); if (ord < 0) { return -1; } return counts.get(ord); }
private void processSSDVFacetFields(Map<String,List<SortedSetDocValuesFacetField>> byField, Document doc) throws IOException { //System.out.println("process SSDV: " + byField); for(Map.Entry<String,List<SortedSetDocValuesFacetField>> ent : byField.entrySet()) { String indexFieldName = ent.getKey(); //System.out.println(" field=" + indexFieldName); for(SortedSetDocValuesFacetField facetField : ent.getValue()) { FacetLabel cp = new FacetLabel(facetField.dim, facetField.label); String fullPath = pathToString(cp.components, cp.length); //System.out.println("add " + fullPath); // For facet counts: doc.add(new SortedSetDocValuesField(indexFieldName, new BytesRef(fullPath))); // For drill-down: doc.add(new StringField(indexFieldName, fullPath, Field.Store.NO)); doc.add(new StringField(indexFieldName, facetField.dim, Field.Store.NO)); } } }
String fullPath = FacetsConfig.pathToString(childPath, childPath.length); int max = reader.docFreq(new Term(dimConfig.indexFieldName, fullPath)); int correctedCount = (int) (res.labelValues[i].value.doubleValue() / samplingRate);
private void processSSDVFacetFields(Map<String,List<SortedSetDocValuesFacetField>> byField, Document doc) throws IOException { //System.out.println("process SSDV: " + byField); for(Map.Entry<String,List<SortedSetDocValuesFacetField>> ent : byField.entrySet()) { String indexFieldName = ent.getKey(); //System.out.println(" field=" + indexFieldName); for(SortedSetDocValuesFacetField facetField : ent.getValue()) { FacetLabel cp = new FacetLabel(facetField.dim, facetField.label); String fullPath = pathToString(cp.components, cp.length); //System.out.println("add " + fullPath); // For facet counts: doc.add(new SortedSetDocValuesField(indexFieldName, new BytesRef(fullPath))); // For drill-down: doc.add(new StringField(indexFieldName, fullPath, Field.Store.NO)); FacetsConfig.DimConfig ft = getDimConfig(facetField.dim); if (ft.requireDimensionDrillDown) { doc.add(new StringField(indexFieldName, facetField.dim, Field.Store.NO)); } } } }
String fullPath = FacetsConfig.pathToString(childPath, childPath.length); int max = reader.docFreq(new Term(dimConfig.indexFieldName, fullPath)); int correctedCount = (int) (res.labelValues[i].value.doubleValue() / samplingRate);
d.add(parentStreamField); fullPathField.setStringValue(FacetsConfig.pathToString(categoryPath.components, categoryPath.length)); d.add(fullPathField);
d.add(parentStreamField); fullPathField.setStringValue(FacetsConfig.pathToString(categoryPath.components, categoryPath.length)); d.add(fullPathField);
doc.add(new StringField(indexFieldName, pathToString(label.components, i), Field.Store.NO));
PostingsEnum docs = MultiFields.getTermDocsEnum(indexReader, Consts.FULL, new BytesRef(FacetsConfig.pathToString(cp.components, cp.length)), 0); if (docs != null && docs.nextDoc() != DocIdSetIterator.NO_MORE_DOCS) { ret = docs.docID();