java-user@lucene.apache.org
[Top] [All Lists]

Re: highlighting

Subject: Re: highlighting
From: Doron Cohen
Date: Mon, 25 Sep 2006 14:47:45 -0700
"Stelios Eliakis" <eliakis@xxxxxxxxx> wrote on 23/09/2006 02:39:27:
> I want to extract the Best Fragment (passage) from a text file.
> When I use the following code I take the first fragment that contains my
> query. Nevertheless, the JavaDoc says that the function getBestFragment
> returns the best fragment. Do I something wrong?

That code seems fine to me.

A possible explanation (which I think might be the case here but not sure)
is that getBestFragment*() only accumulates fragments scores for matches of
"unique terms" in the fragment.

Example 1: query = "xy", and the term "xy" appears once in an early
fragment but 3 times in a later fragment. In this case both fragments would
be scored equally, and hence the early fragment would be selected "best"
just because of how the sorting works.

Example 2: query = "xy zw", and the early fragment contains "xy" but a
later fragment contains both "xy" and "zw". In this case the later fragment
would be selected "best".

Does this explain what you see in your program?


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@xxxxxxxxxxxxxxxxx
For additional commands, e-mail: java-user-help@xxxxxxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>