Skip to content

Enhance Site Navigation: Add Search Bar to Navbar #90

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

Open
divine7022 opened this issue Feb 18, 2025 · 18 comments · May be fixed by #91
Open

Enhance Site Navigation: Add Search Bar to Navbar #90

divine7022 opened this issue Feb 18, 2025 · 18 comments · May be fixed by #91

Comments

@divine7022
Copy link
Contributor

To improve site navigation and make it easier for users to find information, this issue proposes adding a search bar to the main navigation bar. This will allow users to quickly search the site's content.

@divine7022 divine7022 linked a pull request Feb 18, 2025 that will close this issue
@dlebauer
Copy link
Member

This is a great idea. If implemented, I think it would be of limited use if the scope only included the webpage content itself.

What would be particularly useful is if it included the Develop Branch of the Documentation. I am not sure how difficult this will be, but it would also be great to update (#18) and index our package documentation.

@divine7022
Copy link
Contributor Author

This is a great idea. If implemented, I think it would be of limited use if the scope only included the webpage content itself.

What would be particularly useful is if it included the Develop Branch of the Documentation. I am not sure how difficult this will be, but it would also be great to update (#18) and index our package documentation.

@dlebauer Okay, I understand. I'll look into including the Develop Branch and indexing the package documentation. Thanks for the feedback!

@dlebauer
Copy link
Member

Thanks @divine7022 ! Just to be clear, I meant 'the develop branch of the documentation' ... not the entire develop branch (though once #18 is implemented it would be great to include that as well).

@divine7022
Copy link
Contributor Author

Thanks @divine7022 ! Just to be clear, I meant 'the develop branch of the documentation' ... not the entire develop branch (though once #18 is implemented it would be great to include that as well).

@dlebauer Got it! Thank you

@divine7022
Copy link
Contributor Author

@dlebauer
Hello sir I am currently working on indexing the develop branch of the documentation using Algolia’s crawler. I’m in the process of setting it up and testing to ensure that search results work correctly, and i am trying to make it work.

Let me know if you have any specific requirements or suggestions!
Thank you

@allgandalf
Copy link
Collaborator

Let me know if you have any specific requirements or suggestions!

Can you update this branch with a POC video ?

@divine7022
Copy link
Contributor Author

divine7022 commented Mar 1, 2025

@allgandalf Hello sir Thank you for feedback!

I initially used a local search library, which worked for searching static site content like blogs, publications, and the about page. However, it couldn't search the documentation content since the documentation is rendered from the pecan-documentation repository, which is built by GitHub Actions.

To address this, I integrated Algolia's crawler to index both:

  1. The develop branch of the documentation.
  2. The PecanProject.github.io website.

However, I encountered two issues:

  1. The URLs of the develop branch documentation are indexed properly, but when searching from the website, an extra parameter is being appended to the URL (e.g., http://localhost:3000/pecan-documentation/develop/demo-table.html#demo-table).
  2. For the PecanProject.github.io website, all indexed results are pointing to the base URL (https://pecanproject.github.io/) instead of their respective pages.
  3. And also still there are other issues need to be fixed.
  • I’m investigating how Algolia is handling URL fragments (#demo-table).
  • I’m reviewing Algolia’s crawler configuration to ensure it correctly indexes individual pages on the website.
  • I'll record a POC video demonstrating the current implementation and issues.

@divine7022
Copy link
Contributor Author

Untitled.video.-.Made.with.Clipchamp.2.mp4
Untitled.video.-.Made.with.Clipchamp.3.mp4

Let me know if you have any specific requirements or suggestions!

Can you update this branch with a POC video ?

@divine7022
Copy link
Contributor Author

@allgandalf
Initially, the search bar in this image was built using a local search library, which worked correctly for searching the website's content (such as blogs, about, publications, etc.).

Image
Thank you!

@allgandalf
Copy link
Collaborator

@divine7022 using algolia would cost us $$, i don't think so we want to go down with that appraoch

@dlebauer
Copy link
Member

@allgandalf and @divine7022 could the free tier could meet our needs https://www.algolia.com/pricing ? I doubt we will get anywhere near 10k searches/ month.

@infotroph
Copy link
Member

I do not trust their free tier to be free. From the pricing FAQ: "Search operations are triggered when a search is performed. In autocomplete and search-as-you-type implementations, a new search request is performed on every keystroke." 😬

@allgandalf
Copy link
Collaborator

@infotroph did you check if we can trigger the search on debounced inputs ? a timeout of say 2 seconds after the user has stopped typing would help

@infotroph
Copy link
Member

No, and I do not plan to spend more time on it. PEcAn is built to be reliably free for everyone; Trying to find loopholes to use paid services for free is a bad use of our time.

@allgandalf
Copy link
Collaborator

fair pointtttt

@divine7022
Copy link
Contributor Author

@infotroph did you check if we can trigger the search on debounced inputs ? a timeout of say 2 seconds after the user has stopped typing would help

It seems to be a good idea. Using a debounced input with a 2-second delay before sending a request could significantly reduce the number of API calls, preventing unnecessary searches on every keystroke. This might help us stay within the free tier limits. However, we'd need to test how well it works in practice.

@allgandalf
Copy link
Collaborator

@divine7022 lets get away from using 3rd party tool, try if you can find any open source tool for this, else we should focus on what we can do now with the available resources

@divine7022
Copy link
Contributor Author

Hello @allgandalf,
Got it! I'll look into open source alternatives for search functionality. If I find a suitable one, i will test its integration. Otherwise, will explore how we can enhance the current approach with available resources.

Let me know if you have any preferences regarding potential solutions.

Thanks!

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 a pull request may close this issue.

4 participants