You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@lucene.apache.org by sprateek <12...@gmail.com> on 2011/10/08 13:55:41 UTC

search result and highlighting

Hello All,

If a particular document contains N occurance of Search term then I was to
show it as N results in Search result page.  For example if I am searching
for word 'Hello' and my document contains this word three times then in
search result it should be shown three times (As different results). I also
want that in first result only furst hello should be highlighted and second
result second hello should be highlighted and in third one third hello
should be.

Please let me know if its possible with Lucene or not.

PS

--
View this message in context: http://lucene.472066.n3.nabble.com/search-result-and-highlighting-tp3405250p3405250.html
Sent from the Lucene - General mailing list archive at Nabble.com.

Re: search result and highlighting

Posted by sprateek <12...@gmail.com>.
Thanks Ted!!! :)


Sent from my BlackBerry® smartphone

-----Original Message-----
From: "Ted Dunning [via Lucene]" <ml...@n3.nabble.com>
Date: Sat, 8 Oct 2011 11:33:54 
To: sprateek<12...@gmail.com>
Subject: Re: search result and highlighting



On Sat, Oct 8, 2011 at 4:55 AM, sprateek <12...@gmail.com> wrote:

> Hello All,
>
> If a particular document contains N occurance of Search term then I was to
> show it as N results in Search result page.  For example if I am searching
> for word 'Hello' and my document contains this word three times then in
> search result it should be shown three times (As different results). I also
> want that in first result only furst hello should be highlighted and second
> result second hello should be highlighted and in third one third hello
> should be.
>
> Please let me know if its possible with Lucene or not.
>
>
Yes.  But it will require that you do a bit of coding.

You can pretty easily scan the original result list (of documents each
mentioned once) and create a new list where each match in each document is
mentioned separately.

There isn't anything that does this naturally that I have ever heard of.
 This need is really a function of the presentation layer rather than of the
search layer.


_______________________________________________
If you reply to this email, your message will be added to the discussion below:
http://lucene.472066.n3.nabble.com/search-result-and-highlighting-tp3405250p3405827.html

To unsubscribe from search result and highlighting, visit http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3405250&code=MTI3LjAuMC4xN0BnbWFpbC5jb218MzQwNTI1MHwtNjcwNjQzODg3


--
View this message in context: http://lucene.472066.n3.nabble.com/search-result-and-highlighting-tp3405250p3405828.html
Sent from the Lucene - General mailing list archive at Nabble.com.

Re: search result and highlighting

Posted by Ted Dunning <te...@gmail.com>.
On Sat, Oct 8, 2011 at 4:55 AM, sprateek <12...@gmail.com> wrote:

> Hello All,
>
> If a particular document contains N occurance of Search term then I was to
> show it as N results in Search result page.  For example if I am searching
> for word 'Hello' and my document contains this word three times then in
> search result it should be shown three times (As different results). I also
> want that in first result only furst hello should be highlighted and second
> result second hello should be highlighted and in third one third hello
> should be.
>
> Please let me know if its possible with Lucene or not.
>
>
Yes.  But it will require that you do a bit of coding.

You can pretty easily scan the original result list (of documents each
mentioned once) and create a new list where each match in each document is
mentioned separately.

There isn't anything that does this naturally that I have ever heard of.
 This need is really a function of the presentation layer rather than of the
search layer.