File tree Expand file tree Collapse file tree 3 files changed +9
-10
lines changed
sphinx/themes/basic/static Expand file tree Collapse file tree 3 files changed +9
-10
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
2
* This script contains the language-specific data used by searchtools.js,
3
- * namely the list of stopwords, stemmer, scorer and splitter.
3
+ * namely the set of stopwords, stemmer, scorer and splitter.
4
4
*/
5
5
6
- var stopwords = {{ search_language_stop_words }};
6
+ const stopwords = new Set({{ search_language_stop_words }});
7
+ window.stopwords = stopwords; // Export to global scope
7
8
8
9
{% if search_language_stemming_code %}
9
- /* Non-minified version is copied as a separate JS file , if available */
10
+ /* Non-minified versions are copied as separate JavaScript files , if available */
10
11
{{ search_language_stemming_code|safe }}
11
12
{% endif -%}
12
13
Original file line number Diff line number Diff line change @@ -287,11 +287,8 @@ const Search = {
287
287
const queryTermLower = queryTerm . toLowerCase ( ) ;
288
288
289
289
// maybe skip this "word"
290
- // stopwords array is from language_data.js
291
- if (
292
- stopwords . indexOf ( queryTermLower ) !== - 1 ||
293
- queryTerm . match ( / ^ \d + $ / )
294
- )
290
+ // stopwords set is from language_data.js
291
+ if ( stopwords . has ( queryTermLower ) || queryTerm . match ( / ^ \d + $ / ) )
295
292
return ;
296
293
297
294
// stem the word
Original file line number Diff line number Diff line change 3
3
* namely the list of stopwords, stemmer, scorer and splitter.
4
4
*/
5
5
6
- var stopwords = [ ] ;
6
+ const stopwords = new Set ( [ ] ) ;
7
+ window . stopwords = stopwords ; // Export to global scope
7
8
8
9
9
- /* Non-minified version is copied as a separate JS file , if available */
10
+ /* Non-minified versions are copied as separate JavaScript files , if available */
10
11
11
12
/**
12
13
* Dummy stemmer for languages without stemming rules.
You can’t perform that action at this time.
0 commit comments