Skip to content

Commit b4c2ca5

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 7b4e0c7 commit b4c2ca5

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

openlibrary/plugins/worksearch/schemes/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
escape_unknown_fields,
99
fully_escape_query,
1010
luqum_parser,
11-
sanitize_solr_symbols
11+
sanitize_solr_symbols,
1212
)
1313

1414
logger = logging.getLogger("openlibrary.worksearch")

openlibrary/plugins/worksearch/schemes/tests/test_works.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@
3737
),
3838
'Unmatched double-quote': (
3939
'title:Compilation Group for the "History of Modern China',
40-
'alternative_title:(Compilation Group for the) "History of Modern China"'
40+
'alternative_title:(Compilation Group for the) "History of Modern China"',
4141
),
4242
'Unmatched double-quotes': (
4343
'title:"Compilation Group for the "History of Modern China"',
44-
'alternative_title:"Compilation Group for the "History of Modern China""'
44+
'alternative_title:"Compilation Group for the "History of Modern China""',
4545
),
4646
'Leading text': (
4747
'query here title:food rules author:pollan',

openlibrary/solr/query_utils.py

+2
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ def fully_escape_query(query: str) -> str:
145145
escaped = re.sub(r'AND|OR|NOT', lambda _1: _1.group(0).lower(), escaped)
146146
return escaped
147147

148+
148149
# Ensure solr special symbols are valid in query
149150
def sanitize_solr_symbols(query: str, chars: list[str]) -> str:
150151
for c in chars:
@@ -154,6 +155,7 @@ def sanitize_solr_symbols(query: str, chars: list[str]) -> str:
154155
query = query + f'{c}'
155156
return query
156157

158+
157159
def luqum_parser(query: str) -> Item:
158160
"""
159161
Parses a lucene-like query, with the special binding rules of Open Library.

0 commit comments

Comments
 (0)