You are right! 1)As far as Example 1 is concerned, I don't want these 2 fragments to have the same score.Do you know how could I do this?
2)Furthemore, if a try to take fragment score: Scorer fragmentScore= highlighter.getFragmentScorer(); float fragmentScoreFloat=fragmentScore.getFragmentScore(); I take 0.0. why? 3)Moreover, for some docs lucene don't returns any fragment even if the query exist in the document. why? :) Thanks in advance Stelios Eliakis On 9/26/06, Doron Cohen <[EMAIL PROTECTED]> wrote:
"Stelios Eliakis" <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Stelios Eliakis