コード例 #1
0
 private void appendFacetingOnFields(SolrQuery solrQuery, FacetQuery query) {
   FacetOptions facetOptions = query.getFacetOptions();
   if (facetOptions.getPageable().getPageNumber() > 0) {
     solrQuery.set(FacetParams.FACET_OFFSET, facetOptions.getPageable().getOffset());
   }
   solrQuery.addFacetField(convertFieldListToStringArray(facetOptions.getFacetOnFields()));
   if (facetOptions.hasFacetPrefix()) {
     solrQuery.setFacetPrefix(facetOptions.getFacetPrefix());
   }
   for (FieldWithFacetParameters parametrizedField : facetOptions.getFieldsWithParameters()) {
     addPerFieldFacetParameters(solrQuery, parametrizedField);
     if (parametrizedField.getSort() != null
         && FacetOptions.FacetSort.INDEX.equals(parametrizedField.getSort())) {
       addFieldSpecificParameterToSolrQuery(
           solrQuery,
           parametrizedField,
           new FacetParameter(FacetParams.FACET_SORT, FacetParams.FACET_SORT_INDEX));
     }
   }
 }
コード例 #2
0
 private void addPerFieldFacetParameters(SolrQuery solrQuery, FieldWithFacetParameters field) {
   for (FacetParameter parameter : field) {
     addFieldSpecificParameterToSolrQuery(solrQuery, field, parameter);
   }
 }
コード例 #3
0
 private void addPerFieldHighlightParameters(
     SolrQuery solrQuery, FieldWithHighlightParameters field) {
   for (HighlightParameter option : field) {
     addFieldSpecificParameterToSolrQuery(solrQuery, field, option);
   }
 }