summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoss Johnson <ross.johnson@homemail.com.au>2021-09-19 20:03:14 +1000
committerOlivier Hallot <olivier.hallot@libreoffice.org>2021-09-20 16:15:36 +0200
commita03b2a3c515c5a15cbe22a24ee436fabd9ec272c (patch)
tree4e93b5a4b838c75a9c928d7d8261f7269e621afa
parentf514d2c1eba9998ae67a9b8fd508441b1bebbf49 (diff)
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@libreoffice.org>
-rw-r--r--help3xsl/help.js14
-rw-r--r--source/text/shared/05/new_help.xhp3
2 files changed, 15 insertions, 2 deletions
diff --git a/help3xsl/help.js b/help3xsl/help.js
index 48fdca8bb6..17d4909058 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 b346ee7947..b55185eadc 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>