mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Fixed search boost not being applied to document sections
This commit is contained in:
parent
f13a5526d0
commit
922fde0701
@ -45,11 +45,11 @@ class SearchIndex(BaseIndex):
|
||||
def add_entry_from_context(self, page):
|
||||
index = len(self._entries)
|
||||
super().add_entry_from_context(page)
|
||||
entry = self._entries[index]
|
||||
|
||||
# Add document tags, if any
|
||||
if page.meta.get("tags"):
|
||||
if type(page.meta["tags"]) is list:
|
||||
entry = self._entries[index]
|
||||
entry["tags"] = [
|
||||
str(tag) for tag in page.meta["tags"]
|
||||
]
|
||||
@ -64,7 +64,8 @@ class SearchIndex(BaseIndex):
|
||||
if "search" in page.meta:
|
||||
search = page.meta["search"]
|
||||
if "boost" in search:
|
||||
entry["boost"] = search["boost"]
|
||||
for entry in self._entries[index:]:
|
||||
entry["boost"] = search["boost"]
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Data
|
||||
|
@ -45,11 +45,11 @@ class SearchIndex(BaseIndex):
|
||||
def add_entry_from_context(self, page):
|
||||
index = len(self._entries)
|
||||
super().add_entry_from_context(page)
|
||||
entry = self._entries[index]
|
||||
|
||||
# Add document tags, if any
|
||||
if page.meta.get("tags"):
|
||||
if type(page.meta["tags"]) is list:
|
||||
entry = self._entries[index]
|
||||
entry["tags"] = [
|
||||
str(tag) for tag in page.meta["tags"]
|
||||
]
|
||||
@ -64,7 +64,8 @@ class SearchIndex(BaseIndex):
|
||||
if "search" in page.meta:
|
||||
search = page.meta["search"]
|
||||
if "boost" in search:
|
||||
entry["boost"] = search["boost"]
|
||||
for entry in self._entries[index:]:
|
||||
entry["boost"] = search["boost"]
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Data
|
||||
|
Loading…
Reference in New Issue
Block a user