List of usage examples for org.apache.solr.common.params CommonParams TERMS
String TERMS
To view the source code for org.apache.solr.common.params CommonParams TERMS.
Click Source Link
From source file:org.jahia.services.search.facets.SimpleJahiaJcrFacets.java
License:Open Source License
/** * Returns a list of value constraints and the associated facet counts for each facet field specified in the params. * // w w w . j a va 2 s . c o m * @see FacetParams#FACET_FIELD * @see #getFieldMissingCount * @see #getFacetTermEnumCounts */ public NamedList<Object> getFacetFieldCounts() throws IOException { NamedList<Object> res = new SimpleOrderedMap<Object>(); String[] facetFs = params.getParams(FacetParams.FACET_FIELD); if (null != facetFs) { for (String f : facetFs) { try { String fieldName = StringUtils.substringBeforeLast(f, PROPNAME_INDEX_SEPARATOR); String locale = params.getFieldParam(f, "facet.locale"); ExtendedPropertyDefinition epd = NodeTypeRegistry.getInstance() .getNodeType(params.get("f." + f + ".facet.nodetype")).getPropertyDefinition(fieldName); String fieldNameInIndex = getFieldNameInIndex(f, fieldName, epd, locale); parseParams(FacetParams.FACET_FIELD, f); // TODO: can we use the key to add item in result like in original Solr ??? String termList = localParams == null ? null : localParams.get(CommonParams.TERMS); if (termList != null) { res.add(fieldName + PROPNAME_INDEX_SEPARATOR + fieldNameInIndex, ensureSortingAndNameResolution(params.getFieldParam(f, "facet.sort"), getListedTermCounts(f, epd, fieldNameInIndex, locale, termList), epd, params.getFieldParam(f, "facet.labelRenderer"), LanguageCodeConverters.getLocaleFromCode(locale), fieldNameInIndex)); } else { res.add(fieldName + PROPNAME_INDEX_SEPARATOR + fieldNameInIndex, ensureSortingAndNameResolution(params.getFieldParam(f, "facet.sort"), getTermCounts(f, epd, fieldNameInIndex, locale), epd, params.getFieldParam(f, "facet.labelRenderer"), LanguageCodeConverters.getLocaleFromCode(locale), fieldNameInIndex)); } } catch (Exception e) { logger.error("Cant display facets for: " + f, e); } } } return res; }