Fixed inability to reset search pipeline

This commit is contained in:
squidfunk 2024-03-12 09:07:29 +07:00
parent c8bae9b5b4
commit f3252381da
No known key found for this signature in database
GPG Key ID: 5ED40BC4F9C436DF
4 changed files with 4 additions and 4 deletions

View File

@ -46,7 +46,7 @@ class SearchConfig(Config):
# Settings for search # Settings for search
lang = Optional(LangOption()) lang = Optional(LangOption())
separator = Optional(Type(str)) separator = Optional(Type(str))
pipeline = ListOfItems(Choice(pipeline), default = []) pipeline = Optional(ListOfItems(Choice(pipeline)))
# Settings for text segmentation (Chinese) # Settings for text segmentation (Chinese)
jieba_dict = Optional(Type(str)) jieba_dict = Optional(Type(str))

View File

@ -75,7 +75,7 @@ class SearchPlugin(BasePlugin[SearchConfig]):
) )
# Retrieve default value for pipeline # Retrieve default value for pipeline
if not self.config.pipeline: if self.config.pipeline is None:
self.config.pipeline = list(filter(len, re.split( self.config.pipeline = list(filter(len, re.split(
r"\s*,\s*", self._translate(config, "search.config.pipeline") r"\s*,\s*", self._translate(config, "search.config.pipeline")
))) )))

View File

@ -46,7 +46,7 @@ class SearchConfig(Config):
# Settings for search # Settings for search
lang = Optional(LangOption()) lang = Optional(LangOption())
separator = Optional(Type(str)) separator = Optional(Type(str))
pipeline = ListOfItems(Choice(pipeline), default = []) pipeline = Optional(ListOfItems(Choice(pipeline)))
# Settings for text segmentation (Chinese) # Settings for text segmentation (Chinese)
jieba_dict = Optional(Type(str)) jieba_dict = Optional(Type(str))

View File

@ -75,7 +75,7 @@ class SearchPlugin(BasePlugin[SearchConfig]):
) )
# Retrieve default value for pipeline # Retrieve default value for pipeline
if not self.config.pipeline: if self.config.pipeline is None:
self.config.pipeline = list(filter(len, re.split( self.config.pipeline = list(filter(len, re.split(
r"\s*,\s*", self._translate(config, "search.config.pipeline") r"\s*,\s*", self._translate(config, "search.config.pipeline")
))) )))