Permalink
Browse files

Retrieving as many ancestor paths as possible while getting container…

… child counts for search results to avoid cutting off relevant facet values for deeply nested containers. This fixes #27, the secondary issues listed were addressed by #21 and #13.  Additionally, the item mentioned in #27 needed a reindex since its path was changed at some point from being in SILS to Health Science.
  • Loading branch information...
1 parent 90af2fc commit b68dc3988a595c7242b5f05422cb7e8cfe566da1 @bbpennel bbpennel committed Dec 21, 2011
Showing with 2 additions and 12 deletions.
  1. +2 −12 access/src/main/java/edu/unc/lib/dl/ui/service/SolrQueryLayerService.java
@@ -410,24 +410,14 @@ public void getChildrenCounts(List<BriefObjectMetadataBean> resultList, AccessGr
return;
}
- StringBuilder filterQuery = new StringBuilder();
- filterQuery.append("!").append(solrSettings.getFieldName(SearchFieldKeys.ANCESTOR_PATH))
- .append(':').append(searchSettings.resourceTypeFile);
-
- solrQuery.addFilterQuery(filterQuery.toString());
-
try {
- queryResponse = this.executeQuery(solrQuery);
-
- solrQuery.removeFilterQuery(filterQuery.toString());
-
solrQuery.setFacet(true);
solrQuery.setFacetMinCount(1);
solrQuery.addFacetField(solrSettings.getFieldName(SearchFieldKeys.ANCESTOR_PATH));
- //Set the limit on number of facets to return very high since its not possible to predict the # values without a second query
+ //Retrieve as many ancestor paths as we can get
solrQuery.add("f." + solrSettings.getFieldName(SearchFieldKeys.ANCESTOR_PATH) + ".facet.limit",
- String.valueOf(queryResponse.getResults().getNumFound()));
+ String.valueOf(Integer.MAX_VALUE));
//Don't return any facets past the max tier in the contain set, but don't filter to this since that'd effect counts
StringBuilder facetQuery = new StringBuilder();

0 comments on commit b68dc39

Please sign in to comment.