Skip to content

Conversation

schnerring
Copy link

@schnerring schnerring commented Aug 28, 2024

Summary

I looked at the most recent changes of you FlexSearch implementation to inspire myself and saw that you're not importing the module according to the docs.

Here are the relevant FlexSearch docs to look at: https://github.com/nextapps-de/flexsearch?tab=readme-ov-file#esmes6-bundled-module

<script type="module">

    // FlexSearch is NOT available on window.FlexSearch
    // Access FlexSearch static methods via bundled export (static class methods of FlexSearch)

    import FlexSearch from "./node_modules/flexsearch/dist/flexsearch.bundle.module.min.js";

    const index = FlexSearch.Index(options);
    const document = FlexSearch.Document(options);
    const worker = FlexSearch.Worker(options);

</script>

I think it makes the code a bit more clearer. I have to shamefully admit that I didn't test if this code works with doks. However, here is my theme's implementation, which works: https://github.com/schnerring/hugo-theme-gruvbox/blob/fca542372887af35584e3a079af1ef40c3ac644d/assets/js/flexsearch.js

Motivation

Adhere to FlexSearch docs

Checks

  • Read Creating a pull request
  • Supports all screen sizes (if relevant)
  • Supports both light and dark mode (if relevant)
  • Passes npm run test (if relevant)

Copy link

changeset-bot bot commented Aug 28, 2024

⚠️ No Changeset found

Latest commit: 156961d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant