-
Notifications
You must be signed in to change notification settings - Fork 894
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
Local search with Lunr documentation #1760
Comments
Please note that there is a new pull request related to use of |
Hi, thanks for the reference. I have Lunr working, but I still find the documentation a bit confusing. #1771 is about putting offlineSearch in params, I already had that (I use the example repo as reference). My problem started when I tried to eliminate the warning about algolia_docsearch being deprecated, without this line I'm not sure what is really necessary to enable Lunr. I did try creating the empty files that customizing-algolia-templates says without luck. So not sure if you have to create one or both plus configure params.search.algolia. And this last option is a mystery to my, I haven't found any example of how to configure it. |
Hello, I am struggling with enabling Lunr local search using Docsy 0.8.0. I would like to use this for now (later I would like to use GCS). My hugo.toml contains:
When I run a local build I get this warning:
And my site now contains two search boxes in the nav bar and the left side bar like this: I have also tried like @Marzal to create the empty files that customizing-algolia-templates explains, but that did nothing. It seems that Algolia search is still enabled despite Can anyone help? What am I doing wrong? EDIT: I looked in #1771 but my EDIT2: OK do have to add
But using that search box reverts to GCS search..... I'm now totally confused.... |
Please try to delete or comment out this line (just a guess, untested). |
@deining thanks for your reply. OK I now have this - I commented out the algolia line entirely, and I removed
With that config, running a local build with When I run the build in Cloudflare, the result is here: https://doc-test.castsoftware.com/docs/get-started/ - same behaviour: two search boxes, one does nothing and the other tries to load GCSE search. Looking at the HTML, it seems that the search box that does nothing IS attempting to run Lunr:
Cloudflare tells me it generated and uploaded this file: offline-search-index.587e7e3a7a0ce08f074a6bb48cd4da9f.json - so perhaps that's why it's not working. Something it really not right... I'm wondering whether this is related to running 0.8.0, or at least not running an older release. I have had Lunr working previously, I think with 0.7.0... EDIT: and with just this line in hugo.toml I still have the warning in a local build about two search engines enabled, and two search boxes in the site:
EDIT2:
|
OK so I have fixed my issue. In my main repo where the duplicated search error was located, I am mounting a remote repository module during the Hugo build and this remote repository also has its own hugo.toml file so that we can build that repo just to test that its contents are good without having to build the main repo. The hugo.toml file in the remote repo rather embarrassingly had GCSE search enabled and it was this search that was causing the issue with the duplicated search in the build from the main repo. As soon as I disabled all search options in the remote repo and rebuilt the main, the problem was solved and lunr is working in the main repo. I only discovered this when I changed the main repo search from GCSE to lunr. Since both repos were using the same GCSE search, it wasn't causing an error during the build. Apologies for hijacking the thread and apologies for spamming! Anyway, lesson learnt.....! |
Local search with Lunr says
but
params.algolia_docsearch
is deprecated.https://www.docsy.dev/docs/adding-content/search/#customizing-algolia-templates says to create either
layouts/partials/algolia/head.html
orlayouts/partials/algolia/scripts.html
and leave it empty.While the deprecation warning is
use 'params.search.algolia'
Probably it's a lack of knowledge, but I find the doc rather confusing.
Is there any example of using Lunr ?
The text was updated successfully, but these errors were encountered: