Skip to content

Commit

Permalink
Exclude facets from initial search response
Browse files Browse the repository at this point in the history
  • Loading branch information
jimchamp committed Jun 5, 2024
1 parent 0607d9e commit 5473629
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions openlibrary/plugins/worksearch/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ def do_search(
sort: str | None,
page=1,
rows=100,
facet=True,
spellcheck_count=None,
):
"""
Expand All @@ -325,7 +326,7 @@ def do_search(
else:
fields = list(WorkSearchScheme.default_fetched_fields | {'editions'})
return run_solr_query(
WorkSearchScheme(), param, rows, page, sort, spellcheck_count, fields=fields
WorkSearchScheme(), param, rows, page, sort, spellcheck_count, fields=fields, facet=facet
)


Expand Down Expand Up @@ -511,7 +512,7 @@ def GET(self):
rows = 20
if param:
search_response = do_search(
param, sort, page, rows=rows, spellcheck_count=3
param, sort, page, rows=rows, spellcheck_count=3, facet=False
)
else:
search_response = SearchResponse(
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/work_search.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ <h1>$_("Search Books")</h1>
<h3>$_("BARF! Search engine ERROR!")</h3>
<pre>$search_response.error.decode('utf-8', 'ignore')</pre>
$elif param and len(search_response.docs):
$:render_template('search/work_search_facets', param)
$:render_template('search/work_search_facets', param, facet_counts=search_response.facet_counts)
<!-- /facets -->
</div>

Expand Down

0 comments on commit 5473629

Please sign in to comment.