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

Issue with indexing and text that contains underscores #676

Open
demetris opened this issue Aug 4, 2024 · 2 comments
Open

Issue with indexing and text that contains underscores #676

demetris opened this issue Aug 4, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@demetris
Copy link

demetris commented Aug 4, 2024

Hello, @bglw and all the good people at CloudCannon!

I am building a small site for documenting WooCommerce action hooks and filter hooks. The pages are named after the hook they document, and they have titles like this:

  • woocommerce_init
  • woocommerce_loaded
  • woocommerce_ajax_get_endpoint
  • etc.

So, the site has a page titled woocommerce_init as well as a page titled woocommerce_loaded. But when I search for init or loaded, Pagefind finds nothing:

20240804-1-pagefind-woocommerce_loaded-annotated

When I search using the full title of the page, e.g., woocommerce_init or woocommerce_loaded, Pagefind finds the pages. It also finds the pages when I search using the full title without the underscores, e.g., woocommerce init or woocommerce loaded:

20240804-2-pagefind-woocommerce_loaded-annotated

20240804-3-pagefind-woocommerce_loaded-annotated

If I rename the page titles to use hyphens instead of underscores (e.g., rename woocommerce_loaded to woocommerce-loaded) and reindex the site, Pagefind gives me the results I expect:

20240804-4-pagefind-woocommerce-loaded-with-hyphen-annotated

Do you know why this happens or if it’s something I can fix on my end?

In case it matters, the site is built with Astro. It is live and the pages in my examples can be accessed here:

Cheers!

@bglw
Copy link
Contributor

bglw commented Aug 15, 2024

Hi @demetris 👋

Interesting! Going to your link I can see the same behavior. I'm unsure why, I'll need to look into that.

Searching for loaded should indeed match woocommerce_loaded — and we have integration tests that ensure that — so there must be some confounding factor with this content in particular. I'll take a look soon 👀

@bglw bglw added the bug Something isn't working label Aug 15, 2024
@demetris
Copy link
Author

Thank you, @bglw.

Looking forward to seeing what you find.

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