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 Itai Peleg <pe...@gmail.com> on 2013/01/09 13:41:28 UTC

getting the offset of hits in a search

Hi,

I'n new to Lucene, and I'm having some problems with the search. Ive been
debugging Lucene in order to find out how I can get for each document what
are its "hits" (the terms that it has that were in the query) and their
offset. Can anyone give me some pointers?

Thanks in advance,
Itai

Re: getting the offset of hits in a search

Posted by Itai Peleg <pe...@gmail.com>.
Great! I'll look into that.

Thanks!


2013/1/9 김한규 <gk...@gmail.com>

> Try SpanTermQuery, getSpans() function. It returns Spans object which you
> can iterate through to find position of every hits in every documents.
>
> http://lucene.apache.org/core/4_0_0/core/org/apache/lucene/search/spans/SpanTermQuery.html
>
> 2013/1/9 Itai Peleg <pe...@gmail.com>
>
> > Hi,
> >
> > I'n new to Lucene, and I'm having some problems with the search. Ive been
> > debugging Lucene in order to find out how I can get for each document
> what
> > are its "hits" (the terms that it has that were in the query) and their
> > offset. Can anyone give me some pointers?
> >
> > Thanks in advance,
> > Itai
> >
>

Re: getting the offset of hits in a search

Posted by 김한규 <gk...@gmail.com>.
Try SpanTermQuery, getSpans() function. It returns Spans object which you
can iterate through to find position of every hits in every documents.
http://lucene.apache.org/core/4_0_0/core/org/apache/lucene/search/spans/SpanTermQuery.html

2013/1/9 Itai Peleg <pe...@gmail.com>

> Hi,
>
> I'n new to Lucene, and I'm having some problems with the search. Ive been
> debugging Lucene in order to find out how I can get for each document what
> are its "hits" (the terms that it has that were in the query) and their
> offset. Can anyone give me some pointers?
>
> Thanks in advance,
> Itai
>