Skip to content

Commit 98d99a0

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

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

Diff for: docs/models.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,9 @@ def sync_to_db(self, decoded_documents):
189189
document["slug"] = Path(document_path).parts[-1]
190190
document["parents"] = " ".join(Path(document_path).parts[:-1])
191191
document["code_references"] = _generate_code_references(document["body"])
192-
document["code_references_search"] = " ".join(document["code_references"].keys())
192+
document["code_references_search"] = " ".join(
193+
document["code_references"].keys()
194+
)
193195
Document.objects.create(
194196
release=self,
195197
path=document_path,
@@ -233,7 +235,7 @@ def _generate_code_references(body):
233235
# 'django.db.models.Index.expressions',
234236
# 'django.db.models.Index.fields',
235237
# ...
236-
#]
238+
# ]
237239
code_references = list(re.findall(r'<dt[^>]+id="([^"]+)"', body))
238240
# As the search term can be "expressions", "Index.expressions" etc. create a mapping
239241
# between potential code search terms and their HTML id.

Diff for: docs/search.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@
4343
SearchVector("title", weight="A", config=F("config"))
4444
+ SearchVector(KeyTextTransform("slug", "metadata"), weight="A", config=F("config"))
4545
+ SearchVector(KeyTextTransform("toc", "metadata"), weight="B", config=F("config"))
46-
+ SearchVector(KeyTextTransform("code_references_search", "metadata"), weight="B", config="simple")
46+
+ SearchVector(
47+
KeyTextTransform("code_references_search", "metadata"),
48+
weight="B",
49+
config="simple",
50+
)
4751
+ SearchVector(KeyTextTransform("body", "metadata"), weight="C", config=F("config"))
4852
+ SearchVector(
4953
KeyTextTransform("parents", "metadata"), weight="D", config=F("config")

0 commit comments

Comments
 (0)