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: headings which contain inline code are incomplete when displayed in search results #6132

Closed
4 tasks done
sarcastro opened this issue Oct 4, 2023 · 6 comments
Closed
4 tasks done
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open

Comments

@sarcastro
Copy link

Context

No response

Bug description

When a heading contains inline code and search terms are contained within the heading itself, only the portions of the heading which matched the terms are displayed to the user, with the rest of the heading being omitted entirely.

The result of this is incomplete information being shown to the user and, depending on the text that's missing, can display confusing and/or factually incorrect results to the user.

Note: If the matched search term(s) are contained in the content beneath the heading only (i.e. not within the heading itself) then the headings are displayed properly.

Related links

  • Reporting a bug
  • I searched the documentation, discussions and issues to determine if this is expected behaviour and the closest I'm able to find is the Built-in typeset plugin documentation, which this behaviour does seem to contradict.

Reproduction

While I'm happy to provide this if needed, I don't think it provides any benefit in this particular case as the issue is easily reproducible without any special configuration and easily demonstrable using the official project documentation. In lieu of a reproduction .zip, I took screenshots of the official documentation and took care to ensure that they include the URL and version number in them. As such, these can be used as additional examples of steps of steps to reproduce.

Here are screenshots showing numerous ways the Creating a .zip file section in the official project documentation can be displayed depending on the search terms. Section is located on the Creating a reproduction page, coincidentally enough.

❌ Search for zip shows only Creating a .zip:
Screenshot 2023-10-04 000009

❌ Searching for file shows only file:
Screenshot 2023-10-04 000027

✔ Searching for text beneath shows the full heading properly (Creating a .zip file):
Screenshot 2023-10-04 000042

Here's another example, showing the same behaviour on a page heading (rather than section heading), using the Using git sparse-checkout for faster documentation builds page in the official project documentation:

❌ Searching for git sp shows only Using git sparse-checkout:
Screenshot 2023-10-04 003512

❌ Searching for docum shows only for faster documentation builds:
Screenshot 2023-10-04 003535

✔ As with the example above, searching for text beneath it shows the full heading correctly (Using git sparse-checkout for faster documentation builds):
Screenshot 2023-10-04 003620

If you'd still like a reproduction .zip, please just let me know and I'll be happy to provide one.

Steps to reproduce

1. Use inline code in a heading in a markdown file in the documentation.

e.g.
# PLEASE `DO` `NOT` TRY THIS AT HOME!!

2. Perform a search using the built-in search plugin.

A search for home results in: TRY THIS AT HOME:

image

A search for please results in: PLEASE DO:

image

(As a side note, I do see that the exclamation marks are missing too but I haven't investigated it well enough yet to be confident it's a bug. )

Browser

No response

Before submitting

@squidfunk
Copy link
Owner

Thanks for reporting. We're happy to look into it, but:

While I'm happy to provide this if needed, I don't think it provides any benefit in this particular case as the issue is easily reproducible without any special configuration and easily demonstrable using the official project documentation.

Yes, it is necessary. You checked that you carefully read our bug reporting guide, including:

Why we need this: if an issue contains no minimal reproduction or just a link to a repository with thousands of files, the maintainers would need to invest a lot of time into trying to recreate the right conditions to even inspect the bug, let alone fix it.

The moment you provide it, we'll look into it.

@squidfunk squidfunk added the needs reproduction Issue lacks a minimal reproduction .zip file label Oct 4, 2023
@sarcastro
Copy link
Author

9.4.3-inline-code-headings.zip

Here it is. I thought I could get away without it as the conditions/example were already present in the documentation but I do realize the configuration isn't minimal.

Note to self: "If you take shortcuts, you get cut short." -Gary Busey

@squidfunk squidfunk added needs investigation Issue must be investigated by the maintainers bug Issue reports a bug and removed needs reproduction Issue lacks a minimal reproduction .zip file needs investigation Issue must be investigated by the maintainers labels Oct 4, 2023
@squidfunk
Copy link
Owner

Fixed in 57e598b. This was tricky, so I improved the debugging launch configurations in the process in dcf5a80, 34aad07 and 790a446 ☺️ We now explicitly tell only to retrieve partial results for text, and to include the entire line for all other fields. This is kind of a bandaid and will be fixed in the new search, but for now we have to make this distinction. My testing shows that the errors are gone and the entire line is returned at all times.

@squidfunk squidfunk added the resolved Issue is resolved, yet unreleased if open label Oct 5, 2023
@squidfunk
Copy link
Owner

By the way, the reproduction was perfect for debugging, so many thanks for investing the time into it. Without it, I would have had to create one myself first, since debugging the search on a large index as we have it on our own docs is absolutely impractical. Having a small, concise reproduction for testing made fixing this straight-forward.

@squidfunk
Copy link
Owner

Released as part of 9.4.4.

@sarcastro
Copy link
Author

By the way, the reproduction was perfect for debugging, so many thanks for investing the time into it. Without it, I would have had to create one myself first, since debugging the search on a large index as we have it on our own docs is absolutely impractical. Having a small, concise reproduction for testing made fixing this straight-forward.

Your process for creating the reproduction made it a piece of cake and actually took me less time than my initial screenshots did. Thanks a bunch for the quick fix, much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open
Projects
None yet
Development

No branches or pull requests

2 participants