May I have a little help on how to implement term highlighting for my use case?
That's already talked about in some issues but I can't manage to get a proper solution, it seems quite complicated to implement.
I feel I can simply get the position of the term and wrap it between <mark></mark> with JQuery wrap() method for example. Any idea how I can do that?
This is the line where I display the result's extract (for now it's only the first characters of the "content" field, but I'd like it to be say 50 characters before and after the searched term), and here is the line where I whitelist the position metadata (so far that's the only thing I understood).
The site can be previewed here.
If there is an issue specifically with how Lunr is returning positions of matched terms then I can help, unfortunately I can't help you with using the results from Lunr in your application.
May I have a little help on how to implement term highlighting for my use case? That's already talked about in some issues but I can't manage to get a proper solution, it seems quite complicated to implement.
I feel I can simply get the position of the term and wrap it between
<mark></mark>
with JQuerywrap()
method for example. Any idea how I can do that?This is the line where I display the result's extract (for now it's only the first characters of the "content" field, but I'd like it to be say 50 characters before and after the searched term), and here is the line where I whitelist the position metadata (so far that's the only thing I understood). The site can be previewed here.
Any guidelines would be appreciated!