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 Arpad KATONA <a....@ever-team.com> on 2003/05/12 09:43:03 UTC

Highlighting, startOffset, endOffset

Hello Lucene Users,

in order to highlighting terms in a text, i try to use Maik Schreiber's highlighting solution see "Term Highlighter" on :
http://jakarta.apache.org/lucene/docs/contributions.html .
It is based on the "startOffset" and "endOffset" functions of the "org.apache.lucene.analysis.Token" class, see the short code sample below.

org.apache.lucene.analysis.Token token;
TokenStream stream = analyzer.tokenStream(new StringReader(text));
while ((token = stream.next()) != null) {
  int startOffset = token.startOffset();
  int endOffset = token.endOffset();
...
}

The problem is, that these functions "startOffset" and "endOffset" seem to return always 0, do you see why? In the mails archive there is only one mail that treats this thema : 
http://nagoya.apache.org/eyebrowse/ReadMsg?listName=lucene-user@jakarta.apache.org&msgId=489630
From: Tom Dunstan
Subject: Excerpts
Date: Tue, 1 Oct 2002 12:19:29 +0930

but the sender seems to have never got an answer to his mail...

Thank you im voraus

Arpad KATONA
a.katona@ever-team.com


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Re: Highlighting, startOffset, endOffset

Posted by Shoba Ramachandran <sh...@yahoo.com>.
I'm using this termhighlighter and never got any
problem. Could you be elaborate on how you are using
it.

-Shoba
--- Arpad KATONA <a....@ever-team.com> wrote:
> Hello Lucene Users,
> 
> in order to highlighting terms in a text, i try to
> use Maik Schreiber's highlighting solution see "Term
> Highlighter" on :
>
http://jakarta.apache.org/lucene/docs/contributions.html
> .
> It is based on the "startOffset" and "endOffset"
> functions of the "org.apache.lucene.analysis.Token"
> class, see the short code sample below.
> 
> org.apache.lucene.analysis.Token token;
> TokenStream stream = analyzer.tokenStream(new
> StringReader(text));
> while ((token = stream.next()) != null) {
>   int startOffset = token.startOffset();
>   int endOffset = token.endOffset();
> ...
> }
> 
> The problem is, that these functions "startOffset"
> and "endOffset" seem to return always 0, do you see
> why? In the mails archive there is only one mail
> that treats this thema : 
>
http://nagoya.apache.org/eyebrowse/ReadMsg?listName=lucene-user@jakarta.apache.org&msgId=489630
> From: Tom Dunstan
> Subject: Excerpts
> Date: Tue, 1 Oct 2002 12:19:29 +0930
> 
> but the sender seems to have never got an answer to
> his mail...
> 
> Thank you im voraus
> 
> Arpad KATONA
> a.katona@ever-team.com
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> lucene-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org