You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Radha Sreedharan <ra...@gmail.com> on 2009/06/12 19:55:25 UTC

Highlight - SimpleSpanFragment

Hi all,

I am using *SimpleSpanFragment *to find the words a few positions around the
match.

I am specifying the number of characters, which is the second parameter of
the *SimpleSpanFragment *constructor .

However, it always gives the words to the right of the match and does not
give me the words to the left. ( I need both sides ie around the match ).

On searching through the existing material on the forum, I can gather that
getting the words around the match is possible. But, the examples I saw were
for SimpleFragmenter

Is the issue because I am using *SimpleSpanFragment ?  *Why shouldnt it work
for *SimpleSpanFragment  ?
*
Any help will be deeply appreciated..*
*
Regards,
Radha

Re: Highlight - SimpleSpanFragment

Posted by Radha Sreedharan <ra...@gmail.com>.
Currently I am following a long drawn approach where
1) I find index of the matching text in the original
2) For a list of words to the left of index and to the right of index+length
of matching text
3) Then a pick some words from the 1st list and prepend to my  matching text
text and from my second list and append to my  matching text


However I really feel that I am doing something redundant and that Lucene
should be returning me  the matching text !!!

Pls Do help me out in this .

On Fri, Jun 12, 2009 at 11:25 PM, Radha Sreedharan <ra...@gmail.com>wrote:

> Hi all,
>
> I am using *SimpleSpanFragment *to find the words a few positions around
> the match.
>
> I am specifying the number of characters, which is the second parameter of
> the *SimpleSpanFragment *constructor .
>
> However, it always gives the words to the right of the match and does not
> give me the words to the left. ( I need both sides ie around the match ).
>
> On searching through the existing material on the forum, I can gather that
> getting the words around the match is possible. But, the examples I saw were
> for SimpleFragmenter
>
> Is the issue because I am using *SimpleSpanFragment ?  *Why shouldnt it
> work for *SimpleSpanFragment  ?
> *
> Any help will be deeply appreciated..*
> *
> Regards,
> Radha
>