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

orama does not go to the section of the page where the result is #110

Open
EscapedGibbon opened this issue Apr 29, 2024 · 6 comments
Open
Assignees

Comments

@EscapedGibbon
Copy link
Contributor

For some reason the oramasearch doesn't add to the url #the-section-where-it-found-the-match part and instead of going to the page section, only opens the page where the match was found.

@EscapedGibbon EscapedGibbon linked a pull request May 10, 2024 that will close this issue
@EscapedGibbon EscapedGibbon removed a link to a pull request May 10, 2024
@EscapedGibbon
Copy link
Contributor Author

This issue requires PR #98 to be merged before working on it.

@EscapedGibbon EscapedGibbon self-assigned this May 29, 2024
@EscapedGibbon
Copy link
Contributor Author

I would like to hear your opinion about this. So, I looked at the orama plugin of docusaurus v2 and when it was building search sections it used to have a property called "hash".
2024-05-31 13 47 25

With v3 this property was removed.
CleanShot 2024-05-31 at 13 50 59

But the path property remained. Thus, when I console.logged the sections' paths when they are built, for instance our "Glossary" sections looked like this.

CleanShot 2024-05-31 at 13 53 04

Every section in Glossary has the same path, because the the original title section has this path. Therefore, I assume that we can add an anchor to each section's path by adding the section title to the path string(only if the original title !== section title).
This means that the way orama parses HTML content needs to be changed. The function that does it is here.

https://github.com/askorama/orama/blob/f8b04e90f4319b54662efca573aa4e4edde7096e/packages/plugin-docusaurus-v3/src/index.ts#L199

@EscapedGibbon
Copy link
Contributor Author

EscapedGibbon commented May 31, 2024

My questions are:

  1. Does what I am saying make sense?

  2. If yes, should I investigate a bit further and try to fix it at least locally? For example, I am not sure how orama behaves if there several titles in one page which are the same. Or if the title is in not in H1 tags.

  3. What is the approach after? This is the orama issue, not image-js-docs. So how will fixing orama issue look like?

@targos
Copy link
Member

targos commented May 31, 2024

@stropitek I let you answer.

@stropitek
Copy link
Contributor

We looked at this together and plan is to make a PR in orama which adds the hash to the path.

@stropitek
Copy link
Contributor

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

When branches are created from issues, their pull requests are automatically linked.

3 participants