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: Add offline search #120

Merged
merged 4 commits into from
Sep 18, 2023
Merged

Conversation

taorepoara
Copy link
Member

@taorepoara taorepoara commented Sep 6, 2023

Closes #115

Description of the changes

In order to make it easier to find what you're looking for in the documentation, I've added a search form.

Checklist

  • I didn't over-scope my PR
  • My PR title matches the commit convention
  • I did not include breaking changes
  • I made my own code-review before requesting one

I included unit tests that cover my changes

  • 👍 yes
  • 🙅 no, because they aren't needed
  • 🙋 no, because I need help

I added/updated the documentation about my changes

  • 📜 README.md
  • 📕 docs/*.md
  • 📓 docs.lenra.io
  • 🙅 no documentation needed

Technical highlight/advice

I've used the Lunr.js search engine. The search index is generated during the Nginx website generation and it's based on the previously generated HTML pages.

In order to display the search results we need to have the target page content. I load this content when the page is in the results (and not previously loaded).

For this first implementation this only work for the Nginx target (the production one). It would have been much less efficient to handle for the Express target since we would have to regerate the search index at every page load which needs to rendre every HTML pages.

@taorepoara taorepoara added the enhancement New feature or request label Sep 6, 2023
@taorepoara taorepoara self-assigned this Sep 6, 2023
@taorepoara taorepoara linked an issue Sep 6, 2023 that may be closed by this pull request
@taorepoara
Copy link
Member Author

I also added some HTML and CSS fixes that I did not saw earlier

@taorepoara
Copy link
Member Author

For now the search engine is not really offline since load Lunr.js from unpkg.com.

I think that for now it's better for cache management, but we'll have to improve it if we want to make it downloadable locally.

@taorepoara taorepoara marked this pull request as ready for review September 6, 2023 13:30
@jonas-martinez
Copy link
Contributor

@taorepoara I can't make the search system work on my computer. Maybe something needs to be run before ? If so, please add the commands to the README.

Copy link
Contributor

@jonas-martinez jonas-martinez left a comment

Choose a reason for hiding this comment

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

See my comment above

@taorepoara
Copy link
Member Author

@jonas-martinez Have you tried with the Nginx target ?
 

The npm start way wont work, you'll have to do npm run build and then build and run the Dockerfile.

@jonas-martinez
Copy link
Contributor

@taorepoara It stays stuck in the "Starting NGINX" step. I have run the npm run build so I don't understand what I'm missing.
image

@taorepoara
Copy link
Member Author

@taorepoara It stays stuck in the "Starting NGINX" step. I have run the npm run build so I don't understand what I'm missing. image

Have you try to go to https://localhost:8080 after that ?

I'll had more explanation in the doc

@jonas-martinez
Copy link
Contributor

@taorepoara Yes, it doesn't work even when exposing the port 8080.

@taorepoara
Copy link
Member Author

@jonas-martinez It might be due to the macOS config. We'll have to debug it together

@jonas-martinez jonas-martinez merged commit 4de115a into beta Sep 18, 2023
2 checks passed
@jonas-martinez jonas-martinez deleted the 115-task-add-an-offline-search-feature branch September 18, 2023 11:27
@shiipou
Copy link
Contributor

shiipou commented Sep 18, 2023

🎉 This PR is included in version 1.0.0-beta.24 🎉

The release is available on:

Your semantic-release bot 📦🚀

taorepoara added a commit that referenced this pull request Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released on @beta
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task] Add an offline search feature
3 participants