From 990db095fe80904e94a838bcdaa8009205cd04bb Mon Sep 17 00:00:00 2001 From: mjy Date: Wed, 20 Nov 2024 10:19:49 -0600 Subject: [PATCH] Handle blank query term in autocomplete --- lib/queries/collection_object/autocomplete.rb | 1 + lib/queries/query/autocomplete.rb | 3 +-- lib/queries/taxon_name/autocomplete.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/queries/collection_object/autocomplete.rb b/lib/queries/collection_object/autocomplete.rb index 6888ffa9d6..341e90bdc3 100644 --- a/lib/queries/collection_object/autocomplete.rb +++ b/lib/queries/collection_object/autocomplete.rb @@ -83,6 +83,7 @@ def base_queries # @return [Array] # TODO: optimize limits def autocomplete + return [] if term.blank? updated_queries = base_queries result = [] diff --git a/lib/queries/query/autocomplete.rb b/lib/queries/query/autocomplete.rb index f6a7fdce26..68bfa8826e 100644 --- a/lib/queries/query/autocomplete.rb +++ b/lib/queries/query/autocomplete.rb @@ -232,8 +232,7 @@ def combine_or_clauses(clauses) # default the autocomplete result to all # TODO: eliminate def autocomplete - # Probably: super this - # return [] if query_term.blank? + return [] if query_string.blank? all.to_a end diff --git a/lib/queries/taxon_name/autocomplete.rb b/lib/queries/taxon_name/autocomplete.rb index 397ffe13e6..8f617a3d6a 100644 --- a/lib/queries/taxon_name/autocomplete.rb +++ b/lib/queries/taxon_name/autocomplete.rb @@ -226,7 +226,7 @@ def autocomplete_taxon_name_author_year_matches end # def autocomplete_cached - # base_query.where(table[:cached].eq(query_term)) + # base_query.where(table[:cached].eq(query_string)) # end # ---- gin methods