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 Mohsen Saboorian <mo...@gmail.com> on 2007/03/25 08:11:45 UTC

Matched Query Part in Hit Object

Hi,
Is there a way to find the matched part of query string in the Hit object?
Lucene's Hilghlighter module does part of the job, highlighting the matched
word in the result document, however it doesn't give the effective keyword
in query string.
For example, suppose I have a query: "lorem OR elit".

The first matched document is (hit 1): "lorem ipsum dolor sit amet". I want
to find that "lorem" is the matched part of the query.
The second matched document is (hit 2): "consectetur adipisicing elit". I
want to find that "elit" is the matched part of the query.

Thanks in advance.
-- 
View this message in context: http://www.nabble.com/Matched-Query-Part-in-Hit-Object-tf3461413.html#a9657599
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


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


Re: Matched Query Part in Hit Object

Posted by Mohsen Saboorian <mo...@gmail.com>.
Any hint?


Mohsen Saboorian wrote:
> 
> Hi,
> Is there a way to find the matched part of query string in the Hit object?
> Lucene's Hilghlighter module does part of the job, highlighting the
> matched word in the result document, however it doesn't give the effective
> keyword in query string.
> For example, suppose I have a query: "lorem OR elit".
> 
> The first matched document is (hit 1): "lorem ipsum dolor sit amet". I
> want to find that "lorem" is the matched part of the query.
> The second matched document is (hit 2): "consectetur adipisicing elit". I
> want to find that "elit" is the matched part of the query.
> 
> Thanks in advance.
> 

-- 
View this message in context: http://www.nabble.com/Matched-Query-Part-in-Hit-Object-tf3461413.html#a9677750
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


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


Re: Matched Query Part in Hit Object

Posted by Chris Hostetter <ho...@fucit.org>.
Lucene Query objects do not generally "carry" this kind of incormation ...
for debugging purposes you can use the Explanation class, but it is not
particularly efficient.

you may also want to look at SpanQueries ... they are a specialized
subset of Queries which do keep track of this info, and you can call the
getSpans method on them to determine what/where each clause matches on
each document.

: Is there a way to find the matched part of query string in the Hit object?
: Lucene's Hilghlighter module does part of the job, highlighting the matched
: word in the result document, however it doesn't give the effective keyword
: in query string.




-Hoss


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