infotexture / dita-bootstrap.lunr

DITA Open Toolkit plug-in that extends HTML output from the DITA Bootstrap plug-in with a Lunr.js search box
https://infotexture.github.io/dita-bootstrap/search-box.html
Apache License 2.0
0 stars 4 forks source link

Search not working with OT 4.1.1? #15

Closed lakokkonen closed 1 year ago

lakokkonen commented 1 year ago

Hi,

Again: great project, looking forward to using this with DITA Bootstrap!

However, ever since I switched to DITA-OT 4.1.1, the Lunr search stopped working. The LUNR_DATA and PREVIEW_LOOKUP fields in the lunr-client.js file are empty, so basically the index is not being created at all. And naturally the search always finds nothing.

I noticed that this is also the case with the DITA Bootstrap site search, so I would assume this is just work in progress?

jason-fox commented 1 year ago

There is a fix queued in PR #10

jason-fox commented 1 year ago

Now that I look in to it, it is working on 4.0.2 but not 4.1.1 - you can see a working project here

  -  name: Build Bootstrap
-       uses: dita-ot/dita-ot-action@4.0.2
+       uses: dita-ot/dita-ot-action@4.1.1

Leaves the preview.json blank.

jason-fox commented 1 year ago

It looks like the XSLT processor has changed functionality:

<xsl:apply-templates 
-  select="document(document-uri(.))/topics/node()" 
+  select="./topics/node()"
    mode="data-output" />

I've altered PR https://github.com/infotexture/dita-bootstrap.lunr/pull/10 to add a hacky workaround to here, but a better solution would be to have two releases of the lunr plugin to cope with both syntaxes or understand why the XSLT processor is now failing.

jason-fox commented 1 year ago

Modernized the merge function here - now seems to work fine for 4.0 and 4.1

lakokkonen commented 1 year ago

Yes, now it's working with 4.1.