org.apache.lucene.search.vectorhighlight
Class BaseFragmentsBuilder

java.lang.Object
  extended by org.apache.lucene.search.vectorhighlight.BaseFragmentsBuilder
All Implemented Interfaces:
FragmentsBuilder
Direct Known Subclasses:
ScoreOrderFragmentsBuilder, SimpleFragmentsBuilder

public abstract class BaseFragmentsBuilder
extends Object
implements FragmentsBuilder


Field Summary
static String[] COLORED_POST_TAGS
           
static String[] COLORED_PRE_TAGS
           
protected  String[] postTags
           
protected  String[] preTags
           
 
Constructor Summary
protected BaseFragmentsBuilder()
           
protected BaseFragmentsBuilder(BoundaryScanner boundaryScanner)
           
protected BaseFragmentsBuilder(String[] preTags, String[] postTags)
           
protected BaseFragmentsBuilder(String[] preTags, String[] postTags, BoundaryScanner boundaryScanner)
           
 
Method Summary
 String createFragment(IndexReader reader, int docId, String fieldName, FieldFragList fieldFragList)
          create a fragment.
 String createFragment(IndexReader reader, int docId, String fieldName, FieldFragList fieldFragList, String[] preTags, String[] postTags, Encoder encoder)
          create a fragment.
 String[] createFragments(IndexReader reader, int docId, String fieldName, FieldFragList fieldFragList, int maxNumFragments)
          create multiple fragments.
 String[] createFragments(IndexReader reader, int docId, String fieldName, FieldFragList fieldFragList, int maxNumFragments, String[] preTags, String[] postTags, Encoder encoder)
          create multiple fragments.
protected  Field[] getFields(IndexReader reader, int docId, String fieldName)
           
protected  String[] getFieldValues(IndexReader reader, int docId, String fieldName)
          Deprecated. 
protected  String getFragmentSource(StringBuilder buffer, int[] index, Field[] values, int startOffset, int endOffset)
           
protected  String getFragmentSource(StringBuilder buffer, int[] index, String[] values, int startOffset, int endOffset)
          Deprecated. 
protected  String getFragmentSourceMSO(StringBuilder buffer, int[] index, Field[] values, int startOffset, int endOffset, int[] modifiedStartOffset)
           
 char getMultiValuedSeparator()
           
protected  String getPostTag(int num)
           
protected  String getPostTag(String[] postTags, int num)
           
protected  String getPreTag(int num)
           
protected  String getPreTag(String[] preTags, int num)
           
abstract  List<FieldFragList.WeightedFragInfo> getWeightedFragInfoList(List<FieldFragList.WeightedFragInfo> src)
           
protected  String makeFragment(StringBuilder buffer, int[] index, Field[] values, FieldFragList.WeightedFragInfo fragInfo, String[] preTags, String[] postTags, Encoder encoder)
           
protected  String makeFragment(StringBuilder buffer, int[] index, String[] values, FieldFragList.WeightedFragInfo fragInfo)
          Deprecated. 
 void setMultiValuedSeparator(char separator)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

preTags

protected String[] preTags

postTags

protected String[] postTags

COLORED_PRE_TAGS

public static final String[] COLORED_PRE_TAGS

COLORED_POST_TAGS

public static final String[] COLORED_POST_TAGS
Constructor Detail

BaseFragmentsBuilder

protected BaseFragmentsBuilder()

BaseFragmentsBuilder

protected BaseFragmentsBuilder(String[] preTags,
                               String[] postTags)

BaseFragmentsBuilder

protected BaseFragmentsBuilder(BoundaryScanner boundaryScanner)

BaseFragmentsBuilder

protected BaseFragmentsBuilder(String[] preTags,
                               String[] postTags,
                               BoundaryScanner boundaryScanner)
Method Detail

getWeightedFragInfoList

public abstract List<FieldFragList.WeightedFragInfo> getWeightedFragInfoList(List<FieldFragList.WeightedFragInfo> src)

createFragment

public String createFragment(IndexReader reader,
                             int docId,
                             String fieldName,
                             FieldFragList fieldFragList)
                      throws IOException
Description copied from interface: FragmentsBuilder
create a fragment.

Specified by:
createFragment in interface FragmentsBuilder
Parameters:
reader - IndexReader of the index
docId - document id to be highlighted
fieldName - field of the document to be highlighted
fieldFragList - FieldFragList object
Returns:
a created fragment or null when no fragment created
Throws:
IOException

createFragments

public String[] createFragments(IndexReader reader,
                                int docId,
                                String fieldName,
                                FieldFragList fieldFragList,
                                int maxNumFragments)
                         throws IOException
Description copied from interface: FragmentsBuilder
create multiple fragments.

Specified by:
createFragments in interface FragmentsBuilder
Parameters:
reader - IndexReader of the index
docId - document id to be highlighter
fieldName - field of the document to be highlighted
fieldFragList - FieldFragList object
maxNumFragments - maximum number of fragments
Returns:
created fragments or null when no fragments created. size of the array can be less than maxNumFragments
Throws:
IOException

createFragment

public String createFragment(IndexReader reader,
                             int docId,
                             String fieldName,
                             FieldFragList fieldFragList,
                             String[] preTags,
                             String[] postTags,
                             Encoder encoder)
                      throws IOException
Description copied from interface: FragmentsBuilder
create a fragment.

Specified by:
createFragment in interface FragmentsBuilder
Parameters:
reader - IndexReader of the index
docId - document id to be highlighted
fieldName - field of the document to be highlighted
fieldFragList - FieldFragList object
preTags - pre-tags to be used to highlight terms
postTags - post-tags to be used to highlight terms
encoder - an encoder that generates encoded text
Returns:
a created fragment or null when no fragment created
Throws:
IOException

createFragments

public String[] createFragments(IndexReader reader,
                                int docId,
                                String fieldName,
                                FieldFragList fieldFragList,
                                int maxNumFragments,
                                String[] preTags,
                                String[] postTags,
                                Encoder encoder)
                         throws IOException
Description copied from interface: FragmentsBuilder
create multiple fragments.

Specified by:
createFragments in interface FragmentsBuilder
Parameters:
reader - IndexReader of the index
docId - document id to be highlighter
fieldName - field of the document to be highlighted
fieldFragList - FieldFragList object
maxNumFragments - maximum number of fragments
preTags - pre-tags to be used to highlight terms
postTags - post-tags to be used to highlight terms
encoder - an encoder that generates encoded text
Returns:
created fragments or null when no fragments created. size of the array can be less than maxNumFragments
Throws:
IOException

getFieldValues

@Deprecated
protected String[] getFieldValues(IndexReader reader,
                                             int docId,
                                             String fieldName)
                           throws IOException
Deprecated. 

Throws:
IOException

getFields

protected Field[] getFields(IndexReader reader,
                            int docId,
                            String fieldName)
                     throws IOException
Throws:
IOException

makeFragment

@Deprecated
protected String makeFragment(StringBuilder buffer,
                                         int[] index,
                                         String[] values,
                                         FieldFragList.WeightedFragInfo fragInfo)
Deprecated. 


makeFragment

protected String makeFragment(StringBuilder buffer,
                              int[] index,
                              Field[] values,
                              FieldFragList.WeightedFragInfo fragInfo,
                              String[] preTags,
                              String[] postTags,
                              Encoder encoder)

getFragmentSourceMSO

protected String getFragmentSourceMSO(StringBuilder buffer,
                                      int[] index,
                                      Field[] values,
                                      int startOffset,
                                      int endOffset,
                                      int[] modifiedStartOffset)

getFragmentSource

@Deprecated
protected String getFragmentSource(StringBuilder buffer,
                                              int[] index,
                                              String[] values,
                                              int startOffset,
                                              int endOffset)
Deprecated. 


getFragmentSource

protected String getFragmentSource(StringBuilder buffer,
                                   int[] index,
                                   Field[] values,
                                   int startOffset,
                                   int endOffset)

setMultiValuedSeparator

public void setMultiValuedSeparator(char separator)

getMultiValuedSeparator

public char getMultiValuedSeparator()

getPreTag

protected String getPreTag(int num)

getPostTag

protected String getPostTag(int num)

getPreTag

protected String getPreTag(String[] preTags,
                           int num)

getPostTag

protected String getPostTag(String[] postTags,
                            int num)