-
Notifications
You must be signed in to change notification settings - Fork 9
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
Returning the match indexes along with results? #3
Comments
I'm guessing somewhere around here, we would need to have the ability to add STORED as an option on text fields: Lines 70 to 71 in 0320b41
https://github.com/quickwit-oss/tantivy/blob/main/src/schema/text_options.rs#L27-L32 |
Here's an example I found of using highlighted snippets: |
I haven't thought about this, but it's a valid usecase. It's definitely feasable, but it would significally change the API, so the correct approach requires more thought. First of all, as you correctly said for this to work the text fields should be stored. I don't want it to be the default behavior because storing fields in the index takes space and reading stored fields is not free (as Tantivy documentation puts it As performance goes, I would also make calculating ranges optional (e.g. Also, note that in your example there is only one text field, but there might be more, so we need to return index.search('bersonal coder', fuzzy_distance: 1)
=>
[
{
id: "tt0118767",
match_ranges: {
text_field_1: [[21, 28]],
text_field_2: [[36, 39]],
}
}
] And speaking of the That being said, modifying the source in your fork for your specific usecase shouldn't be very difficult. You would need to add the |
Hello, first of all, thanks for publishing this, looks to be a very interesting gem.
I'm wondering if it would be possible to return the matched text (or index of matched characters) along with the results? This would be useful in cases where a fuzzy match returns results, and I would want to highlight the matching text (or just show a snippet of text around the matching text for context) in the results.
In the readme it says:
So maybe this is not possible, but I figured I would ask anyway:
From your example:
Right now, this is how the search returns:
It would be great to return something like:
That way I could display the results in my search listing like:
I haven't dug into the source yet to see if this is possible, but I figure you'd know the limitations better and might be able to provide some input on if this is feasible.
The text was updated successfully, but these errors were encountered: