Iterating over term matches is a recent need for me, too (experimenting
with ranking matches/passages independently, across documents). I'm using
the new PostingsHighlighter and giving it my own PassageFormatter. This
does no formatting, but does store away the offsets from each Passage.

One big problem with Passage is that it does not give you the Document or
the docID. So, AFAICT, if the Document is needed, then you must manually
iterate TopDocs and call PostingsHighlighter.highlightFields() with a
single docID.


Jon



On Tue, Aug 13, 2013 at 6:55 AM, Michael McCandless <
luc...@mikemccandless.com> wrote:

> If you use PostingsHighlighter, then Passage.getMatchStarts/Ends gives
> you the offsets of each match.  You'd need a custom PassageFormatter
> that takes these ints and saves them somewhere; or possibly the patch
> on LUCENE-4906 (allowing you to return custom objects, not just
> String) from your highlighter.
>
> I'm less familiar with the older highlighters but likely it's possible
> to get the absolute offsets from them as well.
>
> Mike McCandless
>
> http://blog.mikemccandless.com
>
>
> On Mon, Aug 12, 2013 at 1:20 PM, Lingviston
> <vladislav.ermo...@outlook.com> wrote:
> > I think that's OK for me. I just need to know the right way to get them.
> > Notice that queries must support boolean operators, *, ? and qoutes.
> >
> >
> >
> > --
> > View this message in context:
> http://lucene.472066.n3.nabble.com/How-to-get-hits-coordinates-in-Lucene-4-4-0-tp4083913p4084046.html
> > Sent from the Lucene - Java Users mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
> > For additional commands, e-mail: java-user-h...@lucene.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
> For additional commands, e-mail: java-user-h...@lucene.apache.org
>
>


-- 
Jon Stewart, Principal
(646) 719-0317 | j...@lightboxtechnologies.com | Arlington, VA

Reply via email to