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

Search terms appear to only apply to descriptions, not names #271

Open
ian-h-chamberlain opened this issue Jul 12, 2024 · 2 comments
Open
Labels
bug Something isn't working

Comments

@ian-h-chamberlain
Copy link

What happened
Searching for functions by name does not show the function (or functions with similar names) in search results as expected.

Steps to Reproduce
Steps to reproduce the behavior:

  1. Perform a search for the name of a function, e.g. optional
  2. Suggested function names will be shown as completion suggestions - ignore them and search anyway

Example results page: https://noogle.dev/q?term=optional

Expected behavior
I expected searching for e.g. optional to show lib.optional, lib.optionalAttrs, etc. in results (probably as the first result!), but instead the first results are seemingly unrelated; builtins.path, builtins.fetchGit, etc.

My use case here is a Firefox bookmark keyword for quickly searching from the location bar, using the keyword search feature. In this case I've set https://noogle.dev/q?term=%s as the bookmark URL.

Screenshots

Screenshot 2024-07-12 at 10 25 52

Desktop (please complete the following information):

  • OS: macOS Sonoma 14.5 (23F79)
  • Browser: Firefox
  • Version: 127.0.2
  • Screen resolution: 1920x1200
@ian-h-chamberlain ian-h-chamberlain added the bug Something isn't working label Jul 12, 2024
@hsjobeki
Copy link
Collaborator

hsjobeki commented Jul 12, 2024

I'll look into it. This happens, because we use "pagefind" and lib.optional is the title, which is relatively unsimilar to optional since it has lib. (4 char, & length is completely different).

I think i should add the name as a h1 title, which has higher weights, but i need to look into the details, how i currently set things up.

I am also open thankfull for any contribution if you want to fix it based on my description.

@ian-h-chamberlain
Copy link
Author

ian-h-chamberlain commented Jul 12, 2024

Thanks for the quick response! It looks like other users of pagefind have also run into this: CloudCannon/pagefind#437

It seems like adding the name as an h1 would work, an alternative might also be to set a custom attribute with a custom weight with data-pagefind-index-attrs.

If I have some time to try out the dev environment I can try to fix it myself! From the README:

Searching within the page is done via pagefind which is only available in the production build.

Is there something special I'll need to do in order to see pagefind-related changes in a local dev environment?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants