Highlight Keyword in Searchresult + best part

Topics: Customizing Orchard
Sep 26, 2014 at 12:56 AM
Hi!

I want to have a searchresult, which displays the best part of the content item, which is found, and highlight the found keywords.

I looked into the SearchModule, but I have no clue where I should hook up to make my changes. Is there an easy way to do it?

Thanks!
Sep 26, 2014 at 9:18 AM
What do you mean with 'the best part'?

You'll probably want to do that with jQuery. I imagine you have access to the search words the user entered in the search results view. There you can grab them with jQuery, search for the words in the results and highlight them.
Sep 26, 2014 at 6:16 PM
Edited Sep 26, 2014 at 6:17 PM
sanderg wrote:
What do you mean with 'the best part'?
I mean, I will not display the whole part of an contentitem (for example a body with 5000 charakters covers way to much space for a search result). I want the "best part" of the searchresult, thats where the most keywords are found and display them.

I found out that it's possible with lucene.net (Here). But in this case I need to change the lucene orchard module and I don't like it to change core modules. But so far, I didn't find a extension point for that.
Developer
Oct 1, 2014 at 5:36 AM
Can you show what it is that would need to be changed? Maybe you could open an issue for that and suggest an extensibility point.
Oct 1, 2014 at 4:58 PM
Hi! Thanks for your reply. I will dig into in a few days and take a closer look. I am not sure, if there is a plausible way for an extension point. Maybe the Lucene Module can provide this text but you don't have to use it. But as I said, I will dig into and keep you posted.