Thanks Markus, I think I will put this in my notebook of things to try. The
only other option I see at this point is to try to use Highlighter's
NullFragmenter option and parse the whole document out of Lucene to find the
positions of the highlights.


On Wed, Aug 12, 2009 at 2:21 PM, Markus Meyer <[email protected]> wrote:

> Hello Andy,
>
> you could do something similar to what the highlighter does:
> - get the terms/tokens from the query with Query.ExtractTerms()
> - get the tokens from the search result text by analyzing it with
> the same analyzer you used to index the content
> For the tokens that match, you can get the positions in the text
> easily with Token.StartOffset() and Token.EndOffset().
>
> Markus
>
>
> Andrew Schuler schrieb:
> > Hello thanks for the reply.
> > I have played with Highlighter a little. I was hoping that it provided
> some
> > sort of text position or pointer but it doesn't seem to. My understanding
> of
> > the Highlighter is that it sends back a fragment of the text with search
> > terms surrounded by configurable tags. Unless I'm missing something,
> which
> > is certainly possible. What I would like is for it to return a position
> in
> > the overall document that those terms are located. Does that make sense?
> >
> > Is a possible solution (that seem a bit hackish) is to have highlighter
> > return the entire doc (instead of just a fragment) and read through the
> doc
> > for the highlight tags? Not sure how well that would work.
> >
> > -andy
> >
> >
> >
> >
> > On Wed, Aug 12, 2009 at 11:59 AM, Digy <[email protected]> wrote:
> >
> >> Have you seen Highlighter.NET?
> >>
> >>
> https://svn.apache.org/repos/asf/incubator/lucene.net/trunk/C%23/contrib/Hig
> >> hlighter.Net/
> >>
> >> DIGY
> >>
> >> -----Original Message-----
> >> From: Andrew Schuler [mailto:[email protected]]
> >> Sent: Wednesday, August 12, 2009 7:45 PM
> >> To: [email protected]
> >> Subject: get text pointer from hit or possibly highlighter
> >>
> >> I've been doing some research trying to find out about getting a text
> >> position pointer for hits and this list is my last hope. If I have a
> >> (rather
> >> long) text document indexed and I get a hit on said document but the
> search
> >> term shows up near the end of the doc it would be nice to be able to
> know
> >> the position of the hit inside the doc itself. In .NET I'm thinking of
> >> something like a TextPointer. Does anyone know of a clever way to do
> this
> >> with Lucene.Net?
> >>
> >>
> >
>
>

Reply via email to