aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Fetch documents.js on demand when the user clicks the search text boxGöktürk Yüksek2019-12-191-10/+26
| | | | | | | | | Instead of shipping a relatively large ~400K documents.js file on every page load, do it when the user clicks the search text box for the first time. Local performance measurements show that it takes about 350ms to build the index from documents.js after fetching it. Signed-off-by: Göktürk Yüksek <gokturk@gentoo.org>
* search.js: escape HTML/XML tags returned in search resultsGöktürk Yüksek2019-12-191-3/+18
| | | | | | | | | | build_search_documents.py unescapes the escaped tags when creating an index. This is desired as lunr doesn't index them otherwise. For example it indexes '<warning>' properly but not '&lt;warning&gt;'. When we display them on the browser though, we need to escape them again so that they are not interpreted as real tags. Signed-off-by: Göktürk Yüksek <gokturk@gentoo.org>
* search.js: highlight the search terms in resultsGöktürk Yüksek2019-12-191-1/+24
| | | | Signed-off-by: Göktürk Yüksek <gokturk@gentoo.org>
* Rewrite the search functionality and extend the coverageGöktürk Yüksek2019-12-191-12/+10
| | | | | | | | | | | | | | | | | | | The current script only indexes the first <p> in a text.xml, and sometimes only partially if the text is interrupted by another tag such as <c/>. Modify build_search_documents.py such that: - It recursively traverses from chapter all the way down to subsubsection - Each <p>, <important>, <note>, <warning> is indexed separately - In the search results, the match entry will have the title in the form "Chapter[ -> Section[ -> Subsection[ -> Subsubsection]]]" Modify search.js such that: - The ref returned for a match is its index into "documents" array, which makes it possible to retrieve the document in O(1). Signed-off-by: Göktürk Yüksek <gokturk@gentoo.org>
* Implement search functionality via lunr.jsLucas Ramage2019-12-191-0/+60
Bug: https://bugs.gentoo.org/674378 Signed-off-by: Lucas Ramage <ramage.lucas@protonmail.com> Signed-off-by: Göktürk Yüksek <gokturk@gentoo.org>