Skip to content

Commit

Permalink
Merge pull request #35 from CentreForDigitalHumanities/feature/preven…
Browse files Browse the repository at this point in the history
…t-slow-ustc-queries

Do not allow very short USTC queries
  • Loading branch information
tijmenbaarda authored Aug 13, 2024
2 parents 1eeda65 + 0fa0ee2 commit 69da52b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions edpop_explorer/readers/ustc.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ def prepare_data(self):

@classmethod
def transform_query(cls, query: str) -> SQLPreparedQuery:
if len(query.strip()) < 3:
# Do not allow very short USTC queries because they are very slow
raise ReaderError('USTC query must have at least 3 characters.')
where_statement = (
'WHERE E.std_title LIKE ? '
'OR E.author_name_1 LIKE ? '
Expand Down

0 comments on commit 69da52b

Please sign in to comment.