mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Improved resilience of search plugin
This commit is contained in:
parent
57cf39149b
commit
15f15068d9
@ -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"]
|
||||||
|
|
||||||
|
@ -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"]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user