How do I accumulate counts over a MultiReader (2 IndexReader)?
The following code causes an IOException:

      ArrayList<FacetRequest> facetRequests = new ArrayList<FacetRequest>();
      for (String groupField : groupFields)
        facetRequests.add(new CountFacetRequest(new CategoryPath(groupField, 
'/'), 1));

      FacetSearchParams facetSearchParams = new 
FacetSearchParams(facetRequests);
      StandardFacetsAccumulator accumulator = new 
StandardFacetsAccumulator(facetSearchParams, reader, taxonomyReader);
      FacetsCollector facetsCollector = FacetsCollector.create(accumulator);

      // perform documents search and facets accumulation
      searcher.search(query, facetsCollector);

      // return facets results in a proper format
      return getFacetResults(facetsCollector, sr);


Here reader is a MultiReader of 2. I am using Lucene 4.3.1.

The following is the callstack. It looks like it has something to do with the 
MultiReader.
How do I make it work?


java.io.IOException: PANIC: Got unexpected exception while trying to 
get/calculate total counts
      at 
org.apache.lucene.facet.search.StandardFacetsAccumulator.accumulate(StandardFacetsAccumulator.java:156)
      at 
org.apache.lucene.facet.search.StandardFacetsAccumulator.accumulate(StandardFacetsAccumulator.java:378)
      at 
org.apache.lucene.facet.search.FacetsCollector.getFacetResults(FacetsCollector.java:214)
      at 
com.esri.arcgis.search.SearchHandler.getFacetResults(SearchHandler.java:551)
      at com.esri.arcgis.search.SearchHandler.search(SearchHandler.java:350)
      at com.esri.arcgis.search.SearchHandler.search(SearchHandler.java:239)
      at com.esri.arcgis.search.test.Searcher.invokeSearch(Searcher.java:58)
      at com.esri.arcgis.search.test.Searcher.main(Searcher.java:32)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 34
      at 
org.apache.lucene.facet.search.CountingAggregator.aggregate(CountingAggregator.java:43)
      at 
org.apache.lucene.facet.search.StandardFacetsAccumulator.fillArraysForPartition(StandardFacetsAccumulator.java:309)
      at 
org.apache.lucene.facet.search.StandardFacetsAccumulator.accumulate(StandardFacetsAccumulator.java:168)
      at 
org.apache.lucene.facet.complements.TotalFacetCounts.compute(TotalFacetCounts.java:176)
      at 
org.apache.lucene.facet.complements.TotalFacetCountsCache.computeAndCache(TotalFacetCountsCache.java:157)
      at 
org.apache.lucene.facet.complements.TotalFacetCountsCache.getTotalCounts(TotalFacetCountsCache.java:104)
      at 
org.apache.lucene.facet.search.StandardFacetsAccumulator.accumulate(StandardFacetsAccumulator.java:129)
      ... 7 more





Reply via email to