[NEW] Native search for HTML output

Skip to first unread message

Rob Beezer

Oct 27, 2022, 1:45:46 PM10/27/22
to pretext-...@googlegroups.com
A collaboration initiated by Brad M, with David F and Rob B, has resulted in a
\HUGE improvement in the search capabilities of your HTML output.

The Javascript library is collected online, but then all of the search
functionality is executed in the reader's browser. We are able to tune the
search process based on the *structure* of your PreTeXt project, so this behaves
better than some generic tool. You can see examples now with the Guide, sample
article, sample book, http://abstract.pugetsound.edu/aata/aata.html, and a few
other projects.

Subsection 43.4.9: HTML Search


* Presently opt-in during the soft opening. Enable with the following in the
"html" section of your publication file and rebuild HTML output.

<search variant="default"/>

* Might require the nightly build of the CLI right now. You should see a
search box in the top banner, and another pinned to the lower-right corner of
your browser window.

* In a few weeks this will become opt-out. To opt-out now, set @variant to "none".

* Using Google search *and* this native search together is not supported, you
will get warnings. If you prefer Google search, you will want to opt-out of the
new approach now (or soon).

* Speaking of Google search. We feel this new approach to search is easier to
set-up and yields better results. And the configuration of Google search keeps
changing out from under us. If you would like to be a maintainer for the Google
search feature, please volunteer on pretext-dev for onboarding. Otherwise, I
think this feature is going to rot away like an abandoned house consumed by
blackberry vines.

* Presently highly-tuned for textbooks. I think there is room for an alternate
tuning for reference works and research articles. (One, or two different ones?)
So that explains why @variant is just "none" and "default" right now.

* Critiques of performance and presentation of results to discussion on
pretext-dev and any bugs/issues to pretext-support, please. Or wherever you
are most comfortable. ;-)

Kudos to David and Brad for their work on this! We've wanted this for a long time.


Rob Beezer

Oct 27, 2022, 4:30:09 PM10/27/22
to pretext-...@googlegroups.com
In all the excitement, I forgot to apologize to our international friends. New
search is entirely predicated on text in English.

The tool we are using is Lunr. ("Like Solr, only smaller and not as bright.")
This package *does* support numerous languages we already support, so there is
the possibility of extending its range. However, it not so turnkey, and the
first step requires installing a node package. Which means we would want to
automate creation of an index with the core Python routines and the CLI. (We
might want to also do something similar for English to make searching more


Pop your head up on pretext-dev if this sounds like a project you would like
to explore.


Rob Beezer

Nov 26, 2022, 9:01:54 PM11/26/22
to pretext-...@googlegroups.com
Native search is now the default. In other words, it has become an opt-out
feature. Effective the next time you update the CLI.

If you have Google search configured, you will now have dueling search boxes,
and will get a warning. You'll want to turn off one or the other.

Subsection 43.4.10: HTML Search

Work to provide a second tuning of search (for reference works, rather than just
for textbooks) is in-progress.


Rob Beezer

May 1, 2023, 1:36:27 PM5/1/23
to pretext-...@googlegroups.com
Native search for HTML output is now mature. David F has added Javascript to
produce a "reference" tuning (alongside the existing "textbook" tuning).
Previous messages appended below if you need to know more. No new XSL so this
feature should be available now, no need to get a new version of the CLI.

Reply all
Reply to author
0 new messages