Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support customize flexsearch tokenize option #319

Merged
merged 1 commit into from
Mar 17, 2024

Conversation

loenvom
Copy link
Contributor

@loenvom loenvom commented Mar 13, 2024

The default tokenize option 'forward' for flexsearch is good, and have better performance compare with option 'full'.
But it can not support some partial search, so i think it may be a good idea to set up a param in settings.yaml for user to decide it.
Here are the search effect diagrams of two different configurations. The first one with option 'full' can get more results than the second one with option 'forward'.
image
image

Copy link

netlify bot commented Mar 13, 2024

Deploy Preview for hugo-hextra ready!

Name Link
🔨 Latest commit 7f3b995
🔍 Latest deploy log https://app.netlify.com/sites/hugo-hextra/deploys/65f328b3f5b7360008c76777
😎 Deploy Preview https://deploy-preview-319--hugo-hextra.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

exampleSite/hugo.yaml Outdated Show resolved Hide resolved
Copy link
Owner

@imfing imfing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I think it's a great addition to the search feature.

We could leverage Hugo templates in the flexsearch.js rather than injecting a global variable.

assets/js/flexsearch.js Outdated Show resolved Hide resolved
layouts/partials/scripts.html Outdated Show resolved Hide resolved
@loenvom loenvom force-pushed the feat/custom_flex_search_tokenize branch from 971fda1 to 7f3b995 Compare March 14, 2024 16:41
@loenvom loenvom requested a review from imfing March 14, 2024 16:46
@loenvom loenvom changed the title feat: support customize flexsearch tokenize option && inject hextra p… feat: support customize flexsearch tokenize option Mar 14, 2024
@loenvom
Copy link
Contributor Author

loenvom commented Mar 14, 2024

I'am glad that you like it! I have already submitted a new commit, please help review it again. ✨

Copy link
Owner

@imfing imfing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great! looks good to me 👍

@imfing imfing merged commit c634cb8 into imfing:main Mar 17, 2024
4 checks passed
@imfing
Copy link
Owner

imfing commented Mar 17, 2024

We also need to document this new option once it's release.

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.

2 participants