mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
move templating from searchtools
to documentation_options
This commit is contained in:
parent
d2a15f4035
commit
67cb316ba2
@ -6,5 +6,19 @@ var DOCUMENTATION_OPTIONS = {
|
|||||||
FILE_SUFFIX: '{{ '' if no_search_suffix else file_suffix }}',
|
FILE_SUFFIX: '{{ '' if no_search_suffix else file_suffix }}',
|
||||||
HAS_SOURCE: {{ has_source|lower }},
|
HAS_SOURCE: {{ has_source|lower }},
|
||||||
SOURCELINK_SUFFIX: '{{ sourcelink_suffix }}',
|
SOURCELINK_SUFFIX: '{{ sourcelink_suffix }}',
|
||||||
NAVIGATION_WITH_KEYS: {{ 'true' if theme_navigation_with_keys|tobool else 'false'}}
|
NAVIGATION_WITH_KEYS: {{ 'true' if theme_navigation_with_keys|tobool else 'false'}},
|
||||||
|
SEARCH_LANGUAGE_STOP_WORDS: {{ search_language_stop_words }}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
{% if search_language_stemming_code %}
|
||||||
|
/* Non-minified version JS is _stemmer.js if file is provided */ {% endif -%}
|
||||||
|
{{ search_language_stemming_code|safe }}
|
||||||
|
|
||||||
|
{% if search_scorer_tool %}
|
||||||
|
{{ search_scorer_tool|safe }}
|
||||||
|
{% endif -%}
|
||||||
|
|
||||||
|
{% if search_word_splitter_code %}
|
||||||
|
{{ search_word_splitter_code }}
|
||||||
|
{% endif -%}
|
||||||
|
@ -9,51 +9,43 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
{% if search_language_stemming_code %}
|
if (!Scorer) {
|
||||||
/* Non-minified version JS is _stemmer.js if file is provided */ {% endif -%}
|
/**
|
||||||
{{ search_language_stemming_code|safe }}
|
* Simple result scoring code.
|
||||||
|
*/
|
||||||
|
var Scorer = {
|
||||||
|
// Implement the following function to further tweak the score for each result
|
||||||
|
// The function takes a result array [filename, title, anchor, descr, score]
|
||||||
|
// and returns the new score.
|
||||||
|
/*
|
||||||
|
score: function(result) {
|
||||||
|
return result[4];
|
||||||
|
},
|
||||||
|
*/
|
||||||
|
|
||||||
{% if search_scorer_tool %}
|
// query matches the full name of an object
|
||||||
{{ search_scorer_tool|safe }}
|
objNameMatch: 11,
|
||||||
{% else %}
|
// or matches in the last dotted part of the object name
|
||||||
/**
|
objPartialMatch: 6,
|
||||||
* Simple result scoring code.
|
// Additive scores depending on the priority of the object
|
||||||
*/
|
objPrio: {0: 15, // used to be importantResults
|
||||||
var Scorer = {
|
1: 5, // used to be objectResults
|
||||||
// Implement the following function to further tweak the score for each result
|
2: -5}, // used to be unimportantResults
|
||||||
// The function takes a result array [filename, title, anchor, descr, score]
|
// Used when the priority is not in the mapping.
|
||||||
// and returns the new score.
|
objPrioDefault: 0,
|
||||||
/*
|
|
||||||
score: function(result) {
|
|
||||||
return result[4];
|
|
||||||
},
|
|
||||||
*/
|
|
||||||
|
|
||||||
// query matches the full name of an object
|
// query found in title
|
||||||
objNameMatch: 11,
|
title: 15,
|
||||||
// or matches in the last dotted part of the object name
|
// query found in terms
|
||||||
objPartialMatch: 6,
|
term: 5
|
||||||
// Additive scores depending on the priority of the object
|
};
|
||||||
objPrio: {0: 15, // used to be importantResults
|
}
|
||||||
1: 5, // used to be objectResults
|
|
||||||
2: -5}, // used to be unimportantResults
|
if (!splitQuery) {
|
||||||
// Used when the priority is not in the mapping.
|
function splitQuery(query) {
|
||||||
objPrioDefault: 0,
|
return query.split(/\s+/);
|
||||||
|
}
|
||||||
// query found in title
|
|
||||||
title: 15,
|
|
||||||
// query found in terms
|
|
||||||
term: 5
|
|
||||||
};
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if search_word_splitter_code %}
|
|
||||||
{{ search_word_splitter_code }}
|
|
||||||
{% else %}
|
|
||||||
function splitQuery(query) {
|
|
||||||
return query.split(/\s+/);
|
|
||||||
}
|
}
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search Module
|
* Search Module
|
||||||
@ -146,7 +138,7 @@ var Search = {
|
|||||||
*/
|
*/
|
||||||
query : function(query) {
|
query : function(query) {
|
||||||
var i;
|
var i;
|
||||||
var stopwords = {{ search_language_stop_words }};
|
var stopwords = DOCUMENTATION_OPTIONS.SEARCH_LANGUAGE_STOP_WORDS;
|
||||||
|
|
||||||
// stem the searchterms and add them to the correct list
|
// stem the searchterms and add them to the correct list
|
||||||
var stemmer = new Stemmer();
|
var stemmer = new Stemmer();
|
Loading…
Reference in New Issue
Block a user