Skip to content

Commit

Permalink
Feedback | source child facets renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
snyaggarwal committed Feb 10, 2021
1 parent 15bac4b commit 157daf3
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions core/common/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,13 +251,14 @@ def get_kwargs_filters(self):

def get_facets(self):
facets = dict()
is_source_child_document_model = self.is_source_child_document_model()
if self.should_include_facets() and self.facet_class:
faceted_filters = {to_camel_case(k): v for k, v in self.get_faceted_filters(True).items()}
filters = {
**self.default_filters, **self.get_facet_filters_from_kwargs(), **faceted_filters, 'retired': False
}

if not self._should_exclude_retired_from_search_results() or not self.is_source_child_document_model():
if not self._should_exclude_retired_from_search_results() or not is_source_child_document_model:
filters.pop('retired')

searcher = self.facet_class( # pylint: disable=not-callable
Expand All @@ -271,11 +272,17 @@ def get_facets(self):

if 'source' in self.kwargs:
facets.pop('source', None)
if self.is_source_child_document_model():
facets['collection_membership'] = facets.pop('collection', None)

if 'collection' in self.kwargs:
facets.pop('collection', None)
elif is_source_child_document_model:
facets['collection_membership'] = facets.pop('collection', None)

if is_source_child_document_model:
facets.pop('concept', None)
facets.pop('conceptOwner', None)
facets.pop('conceptOwnerType', None)
facets.pop('conceptSource', None)

return facets

Expand Down

0 comments on commit 157daf3

Please sign in to comment.