Skip to content

Commit

Permalink
Return empty result response if searchtext contains no tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
manisandro committed Oct 8, 2024
1 parent 632e54c commit 6be44bf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/solr_search_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ def __init__(self, tenant, logger):
def search(self, identity, searchtext, filter, limit):
search_permissions = self.search_permissions(identity)
(filterword, tokens) = self.tokenize(searchtext)
if not tokens:
return {'results': [], 'result_counts': []}
filter_ids = filter
if not filter:
# use all permitted facets if filter is empty
Expand Down
2 changes: 2 additions & 0 deletions src/trgm_search_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ def __init__(self, tenant, logger):

def search(self, identity, searchtext, filter, limit):
(filterword, tokens) = self.tokenize(searchtext)
if not tokens:
return {'results': [], 'result_counts': [], 'layer_result_count': 0, 'feature_result_count': 0}
if filterword:
filter = [self.filterwords.get(filterword)]

Expand Down

0 comments on commit 6be44bf

Please sign in to comment.