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

Add support for highlighting and context #200

Closed
Ceres6 opened this issue Dec 5, 2022 · 2 comments
Closed

Add support for highlighting and context #200

Ceres6 opened this issue Dec 5, 2022 · 2 comments
Labels
enhancement New feature or request plugin

Comments

@Ceres6
Copy link

Ceres6 commented Dec 5, 2022

Is your feature request related to a problem? Please describe.
In some context when you are showing results of a query, especially for large documents, it would be useful to have the context where the matching occurred inside the document, to help the user to choose between different results.

Describe the solution you'd like
It should be possible to specify a context length and get an array with data on where matches occurred and tokens/word around that.

My Idea would be to add a field to results like

{
  context: {
    match: string
    position: {
      start: number
      end: number
    }
  }
}

Describe alternatives you've considered
Really any way to get similar info with different format, maybe a snippet.

Additional context

@micheleriva
Copy link
Member

As discussed separately, this will start as a plugin. Thanks Carlos!

@micheleriva micheleriva added enhancement New feature or request plugin labels Dec 6, 2022
@n4bb12
Copy link

n4bb12 commented Jan 21, 2023

It would be great if highlights could be returned in a variant that already contains <mark> wrappers. That way, folks wouldn't need to consume the positions manually and implement something themselves. See Algolia's output for comparison.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request plugin
Projects
None yet
Development

No branches or pull requests

3 participants