How to perform exact phrase search on a Antora generated site offline?

223 Views Asked by At

Wanted to know if there is any Antora extension that supports exact phrase search on Antora generated site in offline mode.

1

There are 1 best solutions below

1
On

To my knowledge, none currently exists.

The existing antora-lunr extension provides code that creates an index during site generation, and uses lunr.js as the search library when browsing the generated site. lunr.js does not support exact phrase search, which is where the limitation exists.

To solve your problem, I'd suggest that you find a library that provide exact phrase search in an offline site, and then figure out how to create an Antora extension that builds the correct index and injects the necessary CSS/JS into the active theme.

That's no simple task, but the antora-lunr extension demonstrates all of the non-search parts that would be required. See: https://gitlab.com/antora/antora-lunr-extension

As for a search library, this might be a contender: https://github.com/nextapps-de/flexsearch But, since the project hasn't been updated in a while, and is incomplete, it's hard to say how much work would be involved it getting it to work.