Uploaded image for project: 'Spring Data for Apache Solr'
  1. Spring Data for Apache Solr
  2. DATASOLR-166

Faceted queries not returning total for individual field values

    Details

    • Type: Bug
    • Status: Waiting for Feedback
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2 RC1 (Dijkstra)
    • Fix Version/s: None
    • Component/s: Repository
    • Labels:
      None

      Description

      I am working on a POC for using Solr with spring-data-solr and spring-data-rest-mvc

      I have my repository defined as follows:

      // Repository 
      public interface ContractRepository extends SolrCrudRepository<Contract, String> {
      
      	@Query("?0")
      	@Facet( fields = "product")
      	FacetPage<Contract> searchAllFieldsWithFacets(@Param("searchStr") String searchStr, Pageable page);
      
      }
      
      // Query that is actually going to Solr when "searchAllFieldsWithFacets?searchStr=Canada" is executed
      select?q=Canada&start=0&rows=20&facet=true&facet.mincount=1&facet.limit=10&facet.field=product&wt=javabin&version=2
      
      // Result of the query (showing only the last part of the result)
      "page" : {
          "size" : 20,
          "totalElements" : 2479,
          "totalPages" : 124,
          "number" : 0
        }
      

      Notice how the facet result appears just as one number under "totalElements". For some reason it is not being expanded into the various values under the faceted field (i.e "product").

      //The same query executed directly in the Solr Admin UI returns the correct results

      "facet_counts": {
          "facet_queries": {},
          "facet_fields": {
            "product": [
              "Consulting",
              836,
              "Software",
              827,
              "Training",
              816
            ]
          },
          "facet_dates": {},
          "facet_ranges": {}
        }
      

      Why is the individual product count missing in the spring-data-solr query?

        Attachments

          Activity

            People

            • Assignee:
              cstrobl Christoph Strobl
              Reporter:
              ajegam Jega A
              Last updater:
              Jega A
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: