/** * A recursive method that walks up the tree of pivot fields/values to build a list of the String * representations of the values that lead down to this PivotFacetValue. * * @return a mutable List of the pivot value Strings leading down to and including this pivot * value, will never be null but may contain nulls * @see PivotFacetField#getValuePath */ public List<String> getValuePath() { List<String> out = parentPivot.getValuePath(); // Note: this code doesn't play nice with custom FieldTypes -- see SOLR-6330 if (null == value) { out.add(null); } else if (value instanceof Date) { out.add(DateFormatUtil.formatExternal((Date) value)); } else { out.add(value.toString()); } return out; }
/** * Given a PivotField constraint, generate a query for the field+value for use in an <code>fq * </code> to verify the constraint count */ private static String buildFilter(PivotField constraint) { Object value = constraint.getValue(); if (null == value) { // facet.missing, exclude any indexed term return "-" + constraint.getField() + ":[* TO *]"; } // otherwise, build up a term filter... String prefix = "{!term f=" + constraint.getField() + "}"; if (value instanceof Date) { return prefix + DateFormatUtil.formatExternal((Date) value); } else { return prefix + value; } }
@SuppressWarnings("deprecation") public String longToString(long val) { return DateFormatUtil.formatExternal((Date) longToObject(val)); }