Skip to content

Commit

Permalink
Use the default Jieba dict for Chinese search if not set (#13005)
Browse files Browse the repository at this point in the history
  • Loading branch information
Snoopy1866 authored Oct 19, 2024
1 parent 25ad2a0 commit 80642f6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sphinx/search/zh.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,10 @@ def __init__(self, options: dict[str, str]) -> None:

def init(self, options: dict[str, str]) -> None:
if JIEBA:
dict_path = options.get('dict')
default_dict_path = os.path.join(
os.path.dirname(jieba.__file__), jieba.DEFAULT_DICT_NAME
)
dict_path = options.get('dict', default_dict_path)
if dict_path and os.path.isfile(dict_path):
jieba.load_userdict(dict_path)

Expand Down

0 comments on commit 80642f6

Please sign in to comment.