Skip to content

Commit

Permalink
fix: don't display debug information by default
Browse files Browse the repository at this point in the history
  • Loading branch information
raphael0202 committed Apr 29, 2024
1 parent 2b3ae2d commit 56ee123
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@ def html_search(
langs: str = "fr,en",
sort_by: str | None = None,
index_id: Annotated[str | None, INDEX_ID_QUERY_PARAM] = None,
# Display debug information in the HTML response
display_debug: bool = False,
):
if not q:
return templates.TemplateResponse("search.html", {"request": request})
Expand All @@ -299,6 +301,7 @@ def html_search(
"sort_by": sort_by,
"results": results,
"es_query": json.dumps(results.debug.query, indent=4),
"display_debug": display_debug,
}
if results.is_success():
results = cast(SuccessSearchResponse, results)
Expand Down
2 changes: 1 addition & 1 deletion app/templates/display_results.html
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ <h3>Runtime errors</h3>
<li class="unavailable">({{ results.page_size }} products per page)</li>
</ul>
{% endif %}
{% if es_query %}
{% if es_query and display_debug %}
<h3>Elasticsearch query</h3>
<pre><code>{{ es_query }}</code></pre>
{% endif %}
Expand Down

0 comments on commit 56ee123

Please sign in to comment.