Skip to content

Commit

Permalink
Merge pull request #275 from NYPL/SFR-1776_HotfixToEscapeWildcardQueries
Browse files Browse the repository at this point in the history
Hotfix: escape "*" in ES queries to prohibit wildcard use in search
  • Loading branch information
Apophenia authored Sep 5, 2023
2 parents 18de551 + 2d72d17 commit d14eab0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion api/elastic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit d14eab0

Please sign in to comment.