new param: searchThreshold
This commit is contained in:
parent
272be8ac88
commit
6258d4dde5
|
@ -273,6 +273,7 @@ enableSearch = true # site search with fuse
|
||||||
enableSearchHighlight = true # when true, search keyword will be highlighted
|
enableSearchHighlight = true # when true, search keyword will be highlighted
|
||||||
searchContent = true # include content to search index
|
searchContent = true # include content to search index
|
||||||
searchDistance = 100 # fuse option: distance
|
searchDistance = 100 # fuse option: distance
|
||||||
|
searchThreshold = 0.4 # 0.0: exact match, 1.0: any match
|
||||||
|
|
||||||
# body
|
# body
|
||||||
enableBreadcrumb = true # breadcrumb for list, single page
|
enableBreadcrumb = true # breadcrumb for list, single page
|
||||||
|
|
|
@ -36,6 +36,7 @@ enableSearchHighlight = true
|
||||||
searchResultPosition = "main" # side, main
|
searchResultPosition = "main" # side, main
|
||||||
searchContent = true # include content to search index
|
searchContent = true # include content to search index
|
||||||
searchDistance = 100 # fuse option
|
searchDistance = 100 # fuse option
|
||||||
|
searchThreshold = 0.4 # 0.0: exact match, 1.0: any match
|
||||||
|
|
||||||
# body
|
# body
|
||||||
enableBreadcrumb = true
|
enableBreadcrumb = true
|
||||||
|
|
|
@ -664,6 +664,8 @@
|
||||||
var enableSearch = JSON.parse({{ $enableSearch | jsonify }});
|
var enableSearch = JSON.parse({{ $enableSearch | jsonify }});
|
||||||
{{ $searchDistance := ($.Param "searchDistance") }}
|
{{ $searchDistance := ($.Param "searchDistance") }}
|
||||||
var searchDistance = JSON.parse({{ $searchDistance | jsonify }});
|
var searchDistance = JSON.parse({{ $searchDistance | jsonify }});
|
||||||
|
{{ $searchThreshold := ($.Param "searchThreshold") }}
|
||||||
|
var searchThreshold = JSON.parse({{ $searchThreshold | jsonify }});
|
||||||
{{ $searchContent := ($.Param "searchContent") }}
|
{{ $searchContent := ($.Param "searchContent") }}
|
||||||
var searchContent = JSON.parse({{ $searchContent | jsonify }});
|
var searchContent = JSON.parse({{ $searchContent | jsonify }});
|
||||||
{{ $enableSearchHighlight := ($.Param "enableSearchHighlight") }}
|
{{ $enableSearchHighlight := ($.Param "enableSearchHighlight") }}
|
||||||
|
@ -694,7 +696,7 @@
|
||||||
searchContent ? ['title', 'description', 'content'] : ['title', 'description'],
|
searchContent ? ['title', 'description', 'content'] : ['title', 'description'],
|
||||||
includeMatches: enableSearchHighlight,
|
includeMatches: enableSearchHighlight,
|
||||||
shouldSort: true, // default: true
|
shouldSort: true, // default: true
|
||||||
threshold: 0.4, // default: 0.6 (0.0 requires a perfect match)
|
threshold: searchThreshold ? searchThreshold : 0.4, // default: 0.6 (0.0 requires a perfect match)
|
||||||
location: 0, // default: 0
|
location: 0, // default: 0
|
||||||
distance: searchDistance ? searchDistance : 100, // default: 100
|
distance: searchDistance ? searchDistance : 100, // default: 100
|
||||||
maxPatternLength: 32,
|
maxPatternLength: 32,
|
||||||
|
|
Loading…
Reference in New Issue