FileDocCategorySizeDatePackage
TextFragment.javaAPI DocApache Lucene 2.1.02009Wed Feb 14 10:46:22 GMT 2007org.apache.lucene.search.highlight

TextFragment

public class TextFragment extends Object
Low-level class used to record information about a section of a document with a score.
author
MAHarwood

Fields Summary
StringBuffer
markedUpText
int
fragNum
int
textStartPos
int
textEndPos
float
score
Constructors Summary
public TextFragment(StringBuffer markedUpText, int textStartPos, int fragNum)

		this.markedUpText=markedUpText;
		this.textStartPos = textStartPos;
		this.fragNum = fragNum;
	
Methods Summary
public booleanfollows(org.apache.lucene.search.highlight.TextFragment fragment)

param
fragment
return
true if this fragment follows the one passed

		return textStartPos == fragment.textEndPos;
	
public intgetFragNum()

return
the fragment sequence number

		return fragNum;
	
public floatgetScore()

		return score;
	
public voidmerge(org.apache.lucene.search.highlight.TextFragment frag2)

param
frag2 Fragment to be merged into this one

    textEndPos = frag2.textEndPos;
    score=Math.max(score,frag2.score);
  
voidsetScore(float score)

		this.score=score;
	
public java.lang.StringtoString()

		return markedUpText.substring(textStartPos, textEndPos);