Search query highlighting in search results

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Search query highlighting in search results

dennis.vis
Hello again,

I have implemented search in my project, but the customer wants some functionality that is not included by default. They would like for the search query to appear in the introduction text of the search results. For instance, a user enters 'foo' as a search query, a list of documents that contain 'foo' is shown, the list items have an introduction text, this introduction text is a snippet of text that contains the word 'foo' and some surrounding text from the document.
I'm guessing this is not standard functionality for search or one of the plugins, so I'll probably have to create this functionality from scratch.
Now before I start String searching all the search results, which is probably not possible due to performance issues, I would like to ask if someone has an idea as how to best create this functionality? Is there perhaps a plugin or addon I have overlooked that does just this? Can I use the existing search functionality to my advantage? Any thoughts on the matter will be very much appreciated!

Dennis Vis
Consultant | Incentro Rotterdam

Fascinatio Boulevard 562-4
Capelle aan den IJssel, The Netherlands, 2909 VA


E: [hidden email]
T: +31102020544
M: +31640801868
W: www.incentro.com
Logo Incentro


_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: Search query highlighting in search results

Wouter Danes-2

I know Jeroen has looked into this for one of the projects we worked on together.

It’s not easy to do in Hippo, but you could leverage f.ex SOLR to do this.

Maybe Reijn wants to pitch in here. J

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Dennis Vis
Sent: woensdag 12 december 2012 13:12
To: Hippo CMS 7 implementation list
Subject: [Hippo-cms7-user] Search query highlighting in search results

 

Hello again,

 

I have implemented search in my project, but the customer wants some functionality that is not included by default. They would like for the search query to appear in the introduction text of the search results. For instance, a user enters 'foo' as a search query, a list of documents that contain 'foo' is shown, the list items have an introduction text, this introduction text is a snippet of text that contains the word 'foo' and some surrounding text from the document.
I'm guessing this is not standard functionality for search or one of the plugins, so I'll probably have to create this functionality from scratch.
Now before I start String searching all the search results, which is probably not possible due to performance issues, I would like to ask if someone has an idea as how to best create this functionality? Is there perhaps a plugin or addon I have overlooked that does just this? Can I use the existing search functionality to my advantage? Any thoughts on the matter will be very much appreciated!


Dennis Vis
Consultant | Incentro Rotterdam

Fascinatio Boulevard 562-4
Capelle aan den IJssel, The Netherlands, 2909 VA


E: [hidden email]
T: +31102020544
M: +31640801868
W: www.incentro.com
Logo Incentro

 


_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Ard
Reply | Threaded
Open this post in threaded view
|

Re: Search query highlighting in search results

Ard
In reply to this post by dennis.vis
On Wed, Dec 12, 2012 at 1:12 PM, Dennis Vis <[hidden email]> wrote:

>
> Hello again,
>
> I have implemented search in my project, but the customer wants some
> functionality that is not included by default. They would like for the
> search query to appear in the introduction text of the search results. For
> instance, a user enters 'foo' as a search query, a list of documents that
> contain 'foo' is shown, the list items have an introduction text, this
> introduction text is a snippet of text that contains the word 'foo' and some
> surrounding text from the document.
> I'm guessing this is not standard functionality for search or one of the
> plugins, so I'll probably have to create this functionality from scratch.
> Now before I start String searching all the search results, which is
> probably not possible due to performance issues, I would like to ask if
> someone has an idea as how to best create this functionality? Is there
> perhaps a plugin or addon I have overlooked that does just this? Can I use
> the existing search functionality to my advantage? Any thoughts on the
> matter will be very much appreciated!

Highlighting is supported through jcr repository, but the results are
not very well in our case, because stuff like html tags from rich text
fields are also included. Through the HST query this is not supported,
however it is not very hard to include it. If you need it earlier you
can :

1) get the from the HstQuery the getQueryAsString
2) Do the jcr query yourself and return Rows instead of Nodes
3) Add rep:excerpt(.) kind of stuff to the query, see [1]
4) Map your results back to hippo beans just like HstQueryResultImpl
does (don't forget to map the results back into their virtual
location, bit tedious job, and fortunately not needed any more with
the 7.8)

Regards Ard


[1] http://wiki.apache.org/jackrabbit/ExcerptProvider

>
> Dennis Vis
> Consultant | Incentro Rotterdam
>
> Fascinatio Boulevard 562-4
> Capelle aan den IJssel, The Netherlands, 2909 VA
>
> E: [hidden email]
> T: +31102020544
> M: +31640801868
> W: www.incentro.com
>
>
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html




--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html