Skip to content

Commit 3609ce9

Browse files
committed
Fix some issues that caused spellcheck not to work.
1 parent f9dc268 commit 3609ce9

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

src/search/views/search_results.py

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ class SearchView(BasicSearchMixin, View):
2020
default_pagination = 10
2121

2222
def get(self, request):
23-
query = request.GET.dict()
24-
query.setdefault("query", "")
23+
req = request.GET.dict()
24+
query = req.setdefault("query", "")
2525
self.search_logger.info(f"QUERY = {query}")
26-
results = self.execute_basic_search(query)
27-
search_form = self.create_search_form(query)
26+
results = self.execute_basic_search(req)
27+
search_form = self.create_search_form(req)
2828

2929
# Populate some CompendiumEntry objects with the data that we found
3030
# from Solr
@@ -33,11 +33,6 @@ def get(self, request):
3333

3434
hits = results["response"]["numFound"]
3535
rows = results["meta"]["rows"] # Entries per page
36-
page = results["meta"]["page"]
37-
38-
# Start/end result numbers
39-
start = min(results["response"]["start"] + 1, hits)
40-
end = results["response"]["start"] + len(entries)
4136

4237
if hits == 0:
4338
n_pages = 0
@@ -49,14 +44,13 @@ def get(self, request):
4944
"search_form": search_form,
5045
"qtime": results["responseHeader"]["QTime"],
5146
"hits": hits,
52-
"page": page,
47+
"page": results["meta"]["page"],
5348
"n_pages": n_pages,
5449
"rows": rows,
55-
"start": start,
56-
"end": end,
50+
# Start/end result numbers
51+
"start": results["response"]["start"] + 1,
52+
"end": results["response"]["start"] + len(entries),
5753
"entries": entries,
58-
"start": start,
59-
"rows": rows,
6054
}
6155

6256
# Check spelling
@@ -89,8 +83,6 @@ def _check_spelling(self, query: str, results: dict):
8983
if no suggested query could be generated.
9084
"""
9185

92-
self.search_logger.info(results)
93-
9486
hits = results["response"]["numFound"]
9587
correctly_spelled = results.get("spellcheck", {}).get("correctlySpelled", True)
9688
correctly_spelled = correctly_spelled or hits > 10

src/utils/test_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def setUp(self, seed=0, create_user=False, preauth=False):
7070
def fail(self, *args, **kwargs):
7171
pass
7272

73-
def wait_for(self, test, max_wait=5, interval=0.1):
73+
def wait_for(self, test, max_wait=10, interval=0.25):
7474
"""
7575
Wait for a test to pass. When it passes we can continue execution. If the
7676
wait exceeds the time limit, then we throw an error.

0 commit comments

Comments
 (0)