public NumberRangePrefixTreeStrategy(NumberRangePrefixTree prefixTree, String fieldName) { super(prefixTree, fieldName); setPruneLeafyBranches(false); setPrefixGridScanLevel(prefixTree.getMaxLevels()-2);//user might want to change, however setPointsOnly(false); setDistErrPct(0); }
/** Calculates facets between {@code start} and {@code end} to a detail level one greater than that provided by the * arguments. For example providing March to October of 2014 would return facets to the day level of those months. * This is just a convenience method. * @see #calcFacets(IndexReaderContext, Bits, Shape, int) */ public Facets calcFacets(IndexReaderContext context, Bits topAcceptDocs, UnitNRShape start, UnitNRShape end) throws IOException { Shape facetRange = getGrid().toRangeShape(start, end); int detailLevel = Math.max(start.getLevel(), end.getLevel()) + 1; return calcFacets(context, topAcceptDocs, facetRange, detailLevel); }
private void setupParent(UnitNRShape unitShape) { parentShape = unitShape.clone(); //Look for existing parentFacet (from previous segment), or create anew if needed parentFacet = facets.parents.get(parentShape); if (parentFacet == null) {//didn't find one; make a new one parentFacet = new Facets.FacetParentVal(); parentFacet.childCountsLen = getGrid().getNumSubCells(parentShape); facets.parents.put(parentShape, parentFacet); } } });
/** {@inheritDoc} */ @Override public List<IndexableField> indexableFields(Columns columns) { Date fromDate = readFrom(columns); Date toDate = readTo(columns); if (fromDate == null && toDate == null) { return Collections.emptyList(); } validate(fromDate, toDate); NRShape shape = makeShape(fromDate, toDate); return Arrays.asList(strategy.createIndexableFields(shape)); }
/** * Builds a new {@link DateRangeMapper}. * * @param field the name of the field * @param validated if the field must be validated * @param from the name of the column containing the from date * @param to the name of the column containing the to date * @param pattern the date pattern */ public DateRangeMapper(String field, Boolean validated, String from, String to, String pattern) { super(field, validated, Arrays.asList(from, to), DATE_TYPES); if (StringUtils.isBlank(from)) { throw new IndexException("from column name is required"); } if (StringUtils.isBlank(to)) { throw new IndexException("to column name is required"); } this.from = from; this.to = to; this.parser = new DateParser(pattern); tree = DateRangePrefixTree.INSTANCE; strategy = new NumberRangePrefixTreeStrategy(tree, field); }
public NumberRangePrefixTreeStrategy(NumberRangePrefixTree prefixTree, String fieldName) { super(prefixTree, fieldName); setPruneLeafyBranches(false); setPrefixGridScanLevel(prefixTree.getMaxLevels()-2);//user might want to change, however setPointsOnly(false); setDistErrPct(0); }