From f3252381da5f603520b1eceffaf1b75e9670fa59 Mon Sep 17 00:00:00 2001 From: squidfunk Date: Tue, 12 Mar 2024 09:07:29 +0700 Subject: [PATCH] Fixed inability to reset search pipeline --- material/plugins/search/config.py | 2 +- material/plugins/search/plugin.py | 2 +- src/plugins/search/config.py | 2 +- src/plugins/search/plugin.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/material/plugins/search/config.py b/material/plugins/search/config.py index 682d9a9e0..f8618185b 100644 --- a/material/plugins/search/config.py +++ b/material/plugins/search/config.py @@ -46,7 +46,7 @@ class SearchConfig(Config): # Settings for search lang = Optional(LangOption()) separator = Optional(Type(str)) - pipeline = ListOfItems(Choice(pipeline), default = []) + pipeline = Optional(ListOfItems(Choice(pipeline))) # Settings for text segmentation (Chinese) jieba_dict = Optional(Type(str)) diff --git a/material/plugins/search/plugin.py b/material/plugins/search/plugin.py index f043e2840..120e7e23d 100644 --- a/material/plugins/search/plugin.py +++ b/material/plugins/search/plugin.py @@ -75,7 +75,7 @@ class SearchPlugin(BasePlugin[SearchConfig]): ) # Retrieve default value for pipeline - if not self.config.pipeline: + if self.config.pipeline is None: self.config.pipeline = list(filter(len, re.split( r"\s*,\s*", self._translate(config, "search.config.pipeline") ))) diff --git a/src/plugins/search/config.py b/src/plugins/search/config.py index 682d9a9e0..f8618185b 100644 --- a/src/plugins/search/config.py +++ b/src/plugins/search/config.py @@ -46,7 +46,7 @@ class SearchConfig(Config): # Settings for search lang = Optional(LangOption()) separator = Optional(Type(str)) - pipeline = ListOfItems(Choice(pipeline), default = []) + pipeline = Optional(ListOfItems(Choice(pipeline))) # Settings for text segmentation (Chinese) jieba_dict = Optional(Type(str)) diff --git a/src/plugins/search/plugin.py b/src/plugins/search/plugin.py index f043e2840..120e7e23d 100644 --- a/src/plugins/search/plugin.py +++ b/src/plugins/search/plugin.py @@ -75,7 +75,7 @@ class SearchPlugin(BasePlugin[SearchConfig]): ) # Retrieve default value for pipeline - if not self.config.pipeline: + if self.config.pipeline is None: self.config.pipeline = list(filter(len, re.split( r"\s*,\s*", self._translate(config, "search.config.pipeline") )))