Skip to content

Commit

Permalink
Merge branch 'dev' into sentry-no-log-keyboardinterrupt
Browse files Browse the repository at this point in the history
  • Loading branch information
Situphen authored Oct 30, 2024
2 parents 6652f62 + f183502 commit e75d86b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
env:
NODE_VERSION: "18" # needs to be also updated in .nvmrc
PYTHON_VERSION: "3.11"
PIP_VERSION: "24.2" # stick to it while https://github.com/pypa/pip/issues/13046 is not fixed, needs to be also updated in scripts/define_variable.sh
PIP_VERSION: "24.3.1" # needs to be also updated in scripts/define_variable.sh
MARIADB_VERSION: "10.4.10"
COVERALLS_VERSION: "3.3.1" # check if Coverage needs to be also updated in requirements-ci.txt
TYPESENSE_VERSION: "27.0" # needs to be also updated in scripts/define_variable.sh
Expand Down
2 changes: 1 addition & 1 deletion scripts/define_variable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if [[ $ZDS_VENV_VERSION == "" ]]; then
fi

if [[ $ZDS_PIP_VERSION == "" ]]; then
ZDS_PIP_VERSION="24.2" # stick to it while https://github.com/pypa/pip/issues/13046 is not fixed, needs to be also updated in .github/workflows/ci.yml
ZDS_PIP_VERSION="24.3.1" # needs to be also updated in .github/workflows/ci.yml
fi

ZDS_NODE_VERSION=$(cat $ZDSSITE_DIR/.nvmrc)
Expand Down
4 changes: 4 additions & 0 deletions zds/search/tests/tests_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ def test_basic_search(self):
) # … and only of the right type …
self.assertEqual(r["document"]["id"], ids[doc_type][i]) # … with the right id !

# Search with a query which returns results, but without highlights:
result = self.client.get(reverse("search:query") + "?q=-c", follow=False)
self.assertEqual(result.status_code, 200)

def test_search_many_pages(self):
if not self.manager.connected:
return
Expand Down
3 changes: 2 additions & 1 deletion zds/search/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ def get_queryset(self):
if "text_match" in entry:
entry["collection"] = search_collections[i]
entry["document"]["final_score"] = entry["text_match"] * entry["document"]["weight"]
entry["document"]["highlights"] = entry["highlights"][0]
if len(entry["highlights"]) > 0:
entry["document"]["highlights"] = entry["highlights"][0]

if "tags" in entry["document"] and "tag_slugs" in entry["document"]:
assert len(entry["document"]["tags"]) == len(entry["document"]["tag_slugs"])
Expand Down

0 comments on commit e75d86b

Please sign in to comment.