-
Notifications
You must be signed in to change notification settings - Fork 50
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
term frequency and multi highlighting #19
Comments
is it already possible to have multi match highlighting using this internal interOr flag? @leeoniya I tried to use it and resulted in a crash with use of .toLowerCase on undefined |
@leeoniya Any update on this? What work is left to be done in order to have multi match highlighting? |
the internals rely on 1:1 mapping between needle terms and matched parts in the haystack items, and this is unlikely to change. probably the best i can do is to expose the internal in terms of integrating with |
so how do I highlight multiple matches within a string today?
|
It is very confusing b/c the demo shows multiple highlights, but it seems like it is not possible to do with the current library? |
this is the first time someone has found the highlighting behavior confusing. if your needle is "my car", it will match and highlight "my fast car". or are you refering to something different? |
@leeoniya Just spent a solid hour on this until I realized that highlighting does not work as I would expect. Haystack:
Needle:
I was expecting both foo instances to be highlighted. |
yes, that's what this issue is about. but there are no demos that show this behavior because it is impossible for such demos to exist :) sorry that you spent an hour before finding this. |
It's alright. I just misunderstood the context of the issue and started with a bad test case. |
Even though it took a hecka of a time to figure out how to make this work (due to this minor hiccup and also figuring out how to search collections with multiple fields), the search results are a night and day difference compared to fuse.js. |
this might be more in the realm of a document search, but could be interesting to explore.
in info() or search() use a sticky regex to walk each matched haystack item with an altenation group, track frequency and have that somehow feed into sort(). also compute all highlight ranges.
also can establish some convention for haystack item parts, like heading|summary|content|footer, and ranges can be relative to partition points.
not sure how far this is worth taking. scope creep is a thing to keep in check.
The text was updated successfully, but these errors were encountered: