Improved resilience of search plugin

This commit is contained in:
squidfunk 2024-03-04 08:11:07 +07:00
parent 57cf39149b
commit 15f15068d9
No known key found for this signature in database
GPG Key ID: 5ED40BC4F9C436DF
2 changed files with 4 additions and 4 deletions

View File

@ -164,7 +164,7 @@ class SearchIndex:
# Add page to search index # Add page to search index
def add_entry_from_context(self, page): def add_entry_from_context(self, page):
search = page.meta.get("search", {}) search = page.meta.get("search") or {}
if search.get("exclude"): if search.get("exclude"):
return return
@ -218,7 +218,7 @@ class SearchIndex:
entry["tags"].append(name) entry["tags"].append(name)
# Set document boost # Set document boost
search = page.meta.get("search", {}) search = page.meta.get("search") or {}
if "boost" in search: if "boost" in search:
entry["boost"] = search["boost"] entry["boost"] = search["boost"]

View File

@ -164,7 +164,7 @@ class SearchIndex:
# Add page to search index # Add page to search index
def add_entry_from_context(self, page): def add_entry_from_context(self, page):
search = page.meta.get("search", {}) search = page.meta.get("search") or {}
if search.get("exclude"): if search.get("exclude"):
return return
@ -218,7 +218,7 @@ class SearchIndex:
entry["tags"].append(name) entry["tags"].append(name)
# Set document boost # Set document boost
search = page.meta.get("search", {}) search = page.meta.get("search") or {}
if "boost" in search: if "boost" in search:
entry["boost"] = search["boost"] entry["boost"] = search["boost"]