From 07da87b5fb72ee617bb52d0e86d9a20e4b612211 Mon Sep 17 00:00:00 2001 From: Lyndsey Jane Moulds <2042238+Apophenia@users.noreply.github.com> Date: Tue, 5 Sep 2023 11:57:20 -0400 Subject: [PATCH 1/2] Hotfix: escape "*" in ES queries to prohibit wildcard use in search --- api/elastic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/elastic.py b/api/elastic.py index 2427748bb41..0b2a7e88de5 100644 --- a/api/elastic.py +++ b/api/elastic.py @@ -190,7 +190,7 @@ def makeDictHashable(cls, object): @staticmethod def escapeSearchQuery(query): return re.sub( - r'[\+\-\&\|\!\(\)\[\]\{\}\^\~\?\:\\\/]{1}', '\\\\\g<0>', query + r'[\*\+\-\&\|\!\(\)\[\]\{\}\^\~\?\:\\\/]{1}', '\\\\\g<0>', query ) def languageQuery(self, workTotals): From 2d72d177c6bba614ef6c770e48af5e0ac37a7564 Mon Sep 17 00:00:00 2001 From: Lyndsey Jane Moulds <2042238+Apophenia@users.noreply.github.com> Date: Tue, 5 Sep 2023 12:06:18 -0400 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26d1c08779a..8ddaafcd724 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # CHANGELOG +## 2023-09-05 version -- v0.12.3 +## Removed +- The "*" character is escaped from queries passed to ElasticSearch, limiting wildcard searches +## Fixed +- High volume of wildcard searches should no longer create unrecoverable queues/timeouts + ## 2023-08-31 version -- v0.12.2 ### Added - Script to count and return ids of PD Univ of Cali Books from Hathitrust