[Libreoffice-commits] help.git: help3xsl/help.js source/text
Ross Johnson (via logerrit)
logerrit at kemper.freedesktop.org
Mon Sep 20 14:15:56 UTC 2021
help3xsl/help.js | 14 +++++++++++++-
source/text/shared/05/new_help.xhp | 3 ++-
2 files changed, 15 insertions(+), 2 deletions(-)
New commits:
commit a03b2a3c515c5a15cbe22a24ee436fabd9ec272c
Author: Ross Johnson <ross.johnson at homemail.com.au>
AuthorDate: Sun Sep 19 20:03:14 2021 +1000
Commit: Olivier Hallot <olivier.hallot at libreoffice.org>
CommitDate: Mon Sep 20 16:15:36 2021 +0200
tdf#123506 - HTML Help pages - group search results under module headings
The "double entries" reported are because the search results
are never grouped according to module (CALC, WRITER, IMPRESS, etc).
Results are now grouped.
The HTML Help page search function uses a "fuzzy" algorithm to pick
matching results. This observation by the reporter is not a bug and
so the main Help page has been updated to include an explanation.
The main Help page has also been updated to draw attention to the
highlighing of the matching characters from the search term, to show
exactly how the match was made.
Change-Id: Ibdb9ac726b36b9dd6f605c854192ec644bfe09e1
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/122312
Tested-by: Jenkins
Reviewed-by: Olivier Hallot <olivier.hallot at libreoffice.org>
diff --git a/help3xsl/help.js b/help3xsl/help.js
index 48fdca8bb..17d490905 100644
--- a/help3xsl/help.js
+++ b/help3xsl/help.js
@@ -73,17 +73,29 @@ function fillIndex(indexEl, content, modules) {
// filter the index list based on search field input
function filter(indexList) {
var results = null;
+ var group = [];
var target = search.value.trim();
var filtered = '';
if (target.length < 1) {
fillIndex(indexEl, fullLinks, modules);
return;
}
+
results = fuzzysort.go(target, bookmarks, {threshold: -15000, key:'text'});
+ // tdf#123506 - Group the filtered list into module groups, keeping the ordering
+ modules.forEach(function(module) {
+ group[module] = '';
+ });
results.forEach(function(result) {
- filtered += '<a href="' + result.obj['url'] + '" class="' + result.obj['app'] + '">' + fuzzysort.highlight(result) + '</a>';
+ group[result.obj['app']] += '<a href="' + result.obj['url'] + '" class="' + result.obj['app'] + '">' + fuzzysort.highlight(result) + '</a>';
});
+ modules.forEach(function(module) {
+ if (group[module].length > 0) {
+ filtered += group[module];
+ }
+ });
+
fillIndex(indexList, filtered, modules);
};
diff --git a/source/text/shared/05/new_help.xhp b/source/text/shared/05/new_help.xhp
index b346ee794..b55185ead 100644
--- a/source/text/shared/05/new_help.xhp
+++ b/source/text/shared/05/new_help.xhp
@@ -43,7 +43,8 @@
<paragraph xml-lang="en-US" id="par_id3151351" role="paragraph">The Help Index displays a list of keywords for all %PRODUCTNAME modules. Click on any keyword in the list to open the linked Help page.</paragraph>
<h3 id="hd_id151534901836252">Searching the Help Index</h3>
<paragraph role="paragraph" id="par_id311534901893169" xml-lang="en-US">Type the keyword in the Search text box. The search is performed immediately, while you type the keyword.</paragraph>
- <paragraph role="paragraph" id="par_id201534891524377" xml-lang="en-US">The search results is displayed as a filtered list of matches. The module name is displayed as a heading on the list. The <emph>GLOBAL</emph> heading indicates a match for keywords relevant to more than one %PRODUCTNAME module. For example, cell borders applies to spreadsheets cells as well as text and presentation table cells or frames.</paragraph>
+ <paragraph role="paragraph" id="par_id171632107583486" xml-lang="en-US">The search results are displayed as a filtered list of matches grouped by module name. The search results also include near matches. The matching parts of the search term are highlighted in each result.</paragraph>
+ <paragraph role="paragraph" id="par_id201534891524377" xml-lang="en-US">The <emph>GLOBAL</emph> heading indicates a match for keywords relevant to more than one %PRODUCTNAME module. For example, cell borders applies to spreadsheets cells as well as text and presentation table cells or frames.</paragraph>
<paragraph role="paragraph" id="par_id261534891513315" xml-lang="en-US">Use the arrow icons on the bottom of the Index to scroll forward or backward the Index entries or filtered result list.</paragraph>
</section>
More information about the Libreoffice-commits
mailing list