Skip to content

Commit

Permalink
OpenConceptLab/ocl_issues#1656 | fixing facets when no search criteri…
Browse files Browse the repository at this point in the history
…a is given
  • Loading branch information
snyaggarwal committed Sep 1, 2023
1 parent a98aa52 commit 6d5b119
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions core/common/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ def get_facets(self):
return facets
faceted_search = self.facet_class( # pylint: disable=not-callable
self.get_search_string(lower=False),
_search=self.__get_search_results(ignore_retired_filter=True, sort=False, highlight=False),
_search=self.__get_search_results(ignore_retired_filter=True, sort=False, highlight=False, force=True),
)
faceted_search.params(request_timeout=ES_REQUEST_TIMEOUT)
try:
Expand Down Expand Up @@ -502,9 +502,9 @@ def __should_query_latest_version(self):

return (not collection or collection.startswith('!')) and (not version or version.startswith('!'))

def __apply_common_search_filters(self, ignore_retired_filter=False):
def __apply_common_search_filters(self, ignore_retired_filter=False, force=False):
results = None
if not self.should_perform_es_search():
if not force and not self.should_perform_es_search():
return results

results = self.document_model.search()
Expand Down Expand Up @@ -593,8 +593,8 @@ def __get_source_version_es_criteria(source_version):
criteria &= Q('match', owner_type=source_version.parent.resource_type)
return criteria

def __get_search_results(self, ignore_retired_filter=False, sort=True, highlight=True): # pylint: disable=too-many-branches,too-many-locals,too-many-statements
results = self.__apply_common_search_filters(ignore_retired_filter)
def __get_search_results(self, ignore_retired_filter=False, sort=True, highlight=True, force=False): # pylint: disable=too-many-branches,too-many-locals,too-many-statements
results = self.__apply_common_search_filters(ignore_retired_filter, force)
if results is None:
return results

Expand Down

0 comments on commit 6d5b119

Please sign in to comment.