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

Hope to add pagefind as the default search engine for the theme to increase search speed #549

Open
coloraven opened this issue Aug 8, 2023 · 3 comments

Comments

@coloraven
Copy link

This theme is exactly what I wanted, but I found that the search speed is too slow during use. I hope to use pagefind as the default search engine for the theme to enhance the search speed. I would like to express my gratitude to those who worked hard to develop this theme.

@alex-shpak
Copy link
Owner

Hello!
I can look at it, is there somewhere comparison in search speed between pagefind and flexsearch?

@coloraven
Copy link
Author

coloraven commented Aug 9, 2023

Hello! I can look at it, is there somewhere comparison in search speed between pagefind and flexsearch?

Perhaps I made a mistake.Maybe the search engine for this theme is not slow, but it does not support searching with Chinese characters. Therefore, it seems that no results have been found, even though the search keyword definitely exists somewhere in the article.
Please visit this Chinese website https://lawrefbook.github.io/ (it's not my site, but mine is similar). After entering a search keyword, nothing can be found.

@loikein
Copy link

loikein commented Aug 13, 2023

it does not support searching with Chinese characters

Hi @coloraven, I have tested on the exampleSite of this theme, and flexsearch does have the ability to search Chinese characters. (code here)

image

I speculate the reason why the lawrefbook's searching functionality does not work is because it is using an old version of the search-data.json. Please see #528 if you want to make a PR over there. They should just delete that assets folder and update to newest version of the theme.


However, @alex-shpak, the problem I have encountered is that flexsearch seems to only create one index for one language, and the logic right now for deciding which language it calls is based on the Hugo multilingual mode (L29 of /layouts/partials/docs/html-head.html). Therefore, for sites with mixed languages (no Languages config, but has proper html lang attributes), only one language can be searched, which is the DefaultContentLanguage.

I have also tried to tweak the way it calls the language, but I really do not know JS well enough to understand what is actually going on there.

On the contrary, pagefind can handle multiple languages all at once, without even the need to specify the language. It seems to be able to index any word independently from the language. (I have tested it on my other site with very messed-up settings and mixed languages for multiple pages.)

So, that was a long way to say that I would also really hope that you could consider using pagefind.

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

No branches or pull requests

3 participants