If !search_config.copy_js
, then perform useless search indexing, and search is disabled
#2403
Labels
C-bug
Category: A bug, incorrect or unintended behavior
Problem
mdBook/src/renderer/html_handlebars/search.rs
Lines 42 to 54 in 3bdcc0a
Here, if
!search_config.copy_js
, thenindex
is not used, so the above expensive computation is wasted.More importantly, since the search index is not written, the search feature does not work.
That is, search is only enabled if
search_config.enable && search_config.copy_js
, instead of the intended behavior of just depending onsearch_config.enable
.Steps
N/A
Possible Solution(s)
The name
copy_js
seems to suggest the use of a CDN if set to false, however, looking atmdBook/src/theme/index.hbs
Line 311 in 3bdcc0a
index.hbs
file and enable them whensearch_config.enable && !search_config.copy_js
.create_files
to write the index JSON file when!search_config.copy_js
.However, if
!search_config.copy_js
disabling the search entirely is the intended behavior (which would be weird), then maybe we should just get rid of it and fully rely onsearch_config.enable
.Notes
Additionally, the search index is unnecessarily duplicated in both
searchindex.json
andsearchindex.js
, which are sequentially tentatively queried bysearcher.js
.Version
The text was updated successfully, but these errors were encountered: