## org.apache.lucene.search.vectorhighlight
Class FastVectorHighlighter

    java.lang.Object
      org.apache.lucene.search.vectorhighlight.FastVectorHighlighter

    public class FastVectorHighlighter

extends java.lang.Object

Another highlighter implementation.

Field Summary
`static boolean` `DEFAULT_FIELD_MATCH`
`static boolean` `DEFAULT_PHRASE_HIGHLIGHT`

Constructor Summary
`FastVectorHighlighter()` the default constructor.
`FastVectorHighlighter(boolean phraseHighlight, boolean fieldMatch)` a constructor.
`FastVectorHighlighter(boolean phraseHighlight, boolean fieldMatch, FragListBuilder fragListBuilder, FragmentsBuilder fragmentsBuilder)` a constructor.

Method Summary
`java.lang.String` `getBestFragment(FieldQuery fieldQuery, IndexReader reader, int docId, java.lang.String fieldName, int fragCharSize)` return the best fragment.
`java.lang.String[]` `getBestFragments(FieldQuery fieldQuery, IndexReader reader, int docId, java.lang.String fieldName, int fragCharSize, int maxNumFragments)` return the best fragments.
`FieldQuery` `getFieldQuery(Query query)` create a FieldQuery object.
`boolean` `isFieldMatch()` return whether fieldMatch or not.
`boolean` `isPhraseHighlight()` return whether phraseHighlight or not.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT_PHRASE_HIGHLIGHT

    public static final boolean DEFAULT_PHRASE_HIGHLIGHT

See Also:
  Constant Field Values

### DEFAULT_FIELD_MATCH

    public static final boolean DEFAULT_FIELD_MATCH

See Also:
  Constant Field Values

Constructor Detail

### FastVectorHighlighter

    public FastVectorHighlighter()

  the default constructor.

### FastVectorHighlighter

    public FastVectorHighlighter(boolean phraseHighlight,
                                 boolean fieldMatch)

  a constructor. Using SimpleFragListBuilder and ScoreOrderFragmentsBuilder.

  Parameters:
    `phraseHighlight` - true or false for phrase highlighting
    `fieldMatch` - true of false for field matching

### FastVectorHighlighter

    public FastVectorHighlighter(boolean phraseHighlight,
                                 boolean fieldMatch,
                                 FragListBuilder fragListBuilder,
                                 FragmentsBuilder fragmentsBuilder)

  a constructor. A FragListBuilder and a FragmentsBuilder can be specified (plugins).

  Parameters:
    `phraseHighlight` - true of false for phrase highlighting
    `fieldMatch` - true of false for field matching
    `fragListBuilder` - an instance of FragListBuilder
    `fragmentsBuilder` - an instance of FragmentsBuilder

Method Detail

### getFieldQuery

    public FieldQuery getFieldQuery(Query query)

  create a FieldQuery object.

  Parameters:
    `query` - a query
  Returns:
    the created FieldQuery object

### getBestFragment

    public final java.lang.String getBestFragment(FieldQuery fieldQuery,
                                                  IndexReader reader,
                                                  int docId,
                                                  java.lang.String fieldName,
                                                  int fragCharSize)
                                           throws java.io.IOException

  return the best fragment.

  Parameters:
    `fieldQuery` - FieldQuery object
    `reader` - IndexReader of the index
    `docId` - document id to be highlighted
    `fieldName` - field of the document to be highlighted
    `fragCharSize` - the length (number of chars) of a fragment
  Returns:
    the best fragment (snippet) string
  Throws:
    `java.io.IOException`

### getBestFragments

    public final java.lang.String[] getBestFragments(FieldQuery fieldQuery,
                                                     IndexReader reader,
                                                     int docId,
                                                     java.lang.String fieldName,
                                                     int fragCharSize,
                                                     int maxNumFragments)
                                              throws java.io.IOException

  return the best fragments.

  Parameters:
    `fieldQuery` - FieldQuery object
    `reader` - IndexReader of the index
    `docId` - document id to be highlighted
    `fieldName` - field of the document to be highlighted
    `fragCharSize` - the length (number of chars) of a fragment
    `maxNumFragments` - maximum number of fragments
  Returns:
    created fragments or null when no fragments created. size of the array can be less than maxNumFragments
  Throws:
    `java.io.IOException`

### isPhraseHighlight

    public boolean isPhraseHighlight()

  return whether phraseHighlight or not.

  Returns:
    whether phraseHighlight or not

### isFieldMatch

    public boolean isFieldMatch()

  return whether fieldMatch or not.

  Returns:
    whether fieldMatch or not

Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.