def _parse_facets(self): """ Parses the facet counts into this Result's facets list. """ result = self._get_result_node() facets = xmlutils.get_sibling_node(result, "lst", "facet_counts") if not facets: return None fields = xmlutils.get_child_node(facets, "lst", "facet_fields") if not fields: return None exceptions = xmlutils.get_child_node(facets, 'str') if exceptions: raise SolrException('There was a java exception: %s' % exceptions.lastChild.wholeText) for facet in xmlutils.get_child_nodes(fields, "lst"): self.facets.append(Facet(facet)) params = self.header.get('params', None) if params is not None: self.date_gap = params.get('facet.date.gap', '+1YEAR') # default to a 1 year gap facet_dates = xmlutils.get_child_node(facets, "lst", "facet_dates") for facet_date in xmlutils.get_child_nodes(facet_dates, "lst"): self.facets.append(DateFacet(facet_date, self.date_gap))
def _parse_facets(self): """ Parses the facet counts into this Result's facets list. """ result = self._get_result_node() facets = xmlutils.get_sibling_node(result, "lst", "facet_counts") if not facets: return None fields = xmlutils.get_child_node(facets, "lst", "facet_fields") if not fields: return None for facet in xmlutils.get_child_nodes(fields, "lst"): self.facets.append(Facet(facet))