refs https://github.com/TryGhost/Team/issues/1675
closes https://github.com/TryGhost/Ghost/issues/15020
- the main css file used for search was accidentally imported in the root js script, causing it to be included alongside the final minified bundle and get injected outside the iframe.
- the main css is pushed as a separate file outside of bundle and used directly as link inside the iframe instead
refs https://github.com/TryGhost/Team/issues/1665
- updates highlight logic for excerpts to show the right text
- breaks highlights by individual words instead of search sentence
refs https://github.com/TryGhost/Team/issues/1665
- in case no data-ghost-search attributes on a site, the keyboard shortcut to enable search is disabled
- allows site owners to completely disable search on their site
refs https://github.com/TryGhost/Team/issues/1665
- previously the search was loading site data on load for indexing, which adds unnecessary load if search is not used
- moves data fetch and indexing to when the search popup is opened first time avoiding unnecessary fetch
refs https://github.com/TryGhost/Team/issues/1665
- adds bold highlight for search term for title and excerpt
- needs logic to truncate to show excerpt highlight if it cuts out
refs https://github.com/TryGhost/Team/issues/1665
- When requesting 'all' resource the search could experience significant performance degradation and would be unresponsive when there are large amounts of posts/tags/authors on the site
- The limit of 10 000 records was chosen as a stopgap solution for experiments in live environment. Once we verify this limit is not causing much trouble, we could increase it if neede
refs https://github.com/TryGhost/Team/issues/1665
- elasticlunr in an abandoned package with quite a lot of security vulnerabilities. it also has worse performance memory/processing wise comparing to flexsearch (benchmark: https://nextapps-de.github.io/flexsearch/bench/)
- fusejs was another option that was consideres. it was not chosed due to it's poor performance.
refs https://github.com/TryGhost/Team/issues/1665
- It is not striclty necessary for the tagsIndex declaration to be in the constructor, but it gives a very clear indication of which variables are a part of the class.