Skip to content

Commit

Permalink
CU-2ghbvr8: empty queries shouldn't break the solr index.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomolopolis committed Jun 16, 2022
1 parent 8a0e751 commit 413e720
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion webapp/api/api/solr_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def collections_available(cdbs: List[int]):

def search_collection(cdbs: List[int], query: str):
query = query.strip().replace(r'\s+', r'\s').split(' ')
if len(query) == 0:
if len(query) == 1 and query[0] == '':
return Response({'results': []})
query = [f'{query[i]}~1' if i < len(query) - 1 else f'{query[i]}*' for i in range(len(query))]

Expand Down
4 changes: 2 additions & 2 deletions webapp/frontend/src/components/common/ConceptPicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default {
searchCUI: _.debounce(function (term, loading) {
loading(true)
if (!term) {
if (!term || term.trim().length === 0) {
return
}
Expand Down Expand Up @@ -88,7 +88,7 @@ export default {
return results
}
searchByTerm()
}, 400)
}, 500)
}
}
</script>
Expand Down

0 comments on commit 413e720

Please sign in to comment.