mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Save search resul score to HTML element for debugging (#10718)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
This commit is contained in:
parent
c5ae5855ae
commit
454ced9cc1
1
CHANGES
1
CHANGES
@ -20,6 +20,7 @@ Features added
|
|||||||
* #10781: Allow :rst:role:`ref` role to be used with definitions and fields.
|
* #10781: Allow :rst:role:`ref` role to be used with definitions and fields.
|
||||||
* #10717: HTML Search: Increase priority for full title and
|
* #10717: HTML Search: Increase priority for full title and
|
||||||
subtitle matches in search results
|
subtitle matches in search results
|
||||||
|
* #10718: HTML Search: Save search result score to the HTML element for debugging
|
||||||
|
|
||||||
Bugs fixed
|
Bugs fixed
|
||||||
----------
|
----------
|
||||||
|
@ -64,7 +64,7 @@ const _displayItem = (item, highlightTerms, searchTerms) => {
|
|||||||
const docLinkSuffix = DOCUMENTATION_OPTIONS.LINK_SUFFIX;
|
const docLinkSuffix = DOCUMENTATION_OPTIONS.LINK_SUFFIX;
|
||||||
const showSearchSummary = DOCUMENTATION_OPTIONS.SHOW_SEARCH_SUMMARY;
|
const showSearchSummary = DOCUMENTATION_OPTIONS.SHOW_SEARCH_SUMMARY;
|
||||||
|
|
||||||
const [docName, title, anchor, descr] = item;
|
const [docName, title, anchor, descr, score, _filename] = item;
|
||||||
|
|
||||||
let listItem = document.createElement("li");
|
let listItem = document.createElement("li");
|
||||||
let requestUrl;
|
let requestUrl;
|
||||||
@ -86,6 +86,7 @@ const _displayItem = (item, highlightTerms, searchTerms) => {
|
|||||||
params.set("highlight", [...highlightTerms].join(" "));
|
params.set("highlight", [...highlightTerms].join(" "));
|
||||||
let linkEl = listItem.appendChild(document.createElement("a"));
|
let linkEl = listItem.appendChild(document.createElement("a"));
|
||||||
linkEl.href = linkUrl + "?" + params.toString() + anchor;
|
linkEl.href = linkUrl + "?" + params.toString() + anchor;
|
||||||
|
linkEl.dataset.score = score;
|
||||||
linkEl.innerHTML = title;
|
linkEl.innerHTML = title;
|
||||||
if (descr)
|
if (descr)
|
||||||
listItem.appendChild(document.createElement("span")).innerHTML =
|
listItem.appendChild(document.createElement("span")).innerHTML =
|
||||||
|
Loading…
Reference in New Issue
Block a user