Class FastVectorHighlighter
Another highlighter implementation.
Inheritance
Namespace: Lucene.Net.Search.VectorHighlight
Assembly: Lucene.Net.Highlighter.dll
Syntax
public class FastVectorHighlighter : object
Constructors
| Improve this Doc View SourceFastVectorHighlighter()
the default constructor.
Declaration
public FastVectorHighlighter()
FastVectorHighlighter(Boolean, Boolean)
a constructor. Using Simple
Declaration
public FastVectorHighlighter(bool phraseHighlight, bool fieldMatch)
Parameters
Type | Name | Description |
---|---|---|
System. |
phraseHighlight | true or false for phrase highlighting |
System. |
fieldMatch | true of false for field matching |
FastVectorHighlighter(Boolean, Boolean, IFragListBuilder, IFragmentsBuilder)
a constructor. A IFrag
Declaration
public FastVectorHighlighter(bool phraseHighlight, bool fieldMatch, IFragListBuilder fragListBuilder, IFragmentsBuilder fragmentsBuilder)
Parameters
Type | Name | Description |
---|---|---|
System. |
phraseHighlight | true of false for phrase highlighting |
System. |
fieldMatch | true of false for field matching |
IFrag |
fragListBuilder | an instance of IFragments |
IFragments |
fragmentsBuilder | an instance of IFragments |
Fields
| Improve this Doc View SourceDEFAULT_FIELD_MATCH
Declaration
public static readonly bool DEFAULT_FIELD_MATCH
Field Value
Type | Description |
---|---|
System. |
DEFAULT_PHRASE_HIGHLIGHT
Declaration
public static readonly bool DEFAULT_PHRASE_HIGHLIGHT
Field Value
Type | Description |
---|---|
System. |
Properties
| Improve this Doc View SourceIsFieldMatch
return whether fieldMatch or not.
Declaration
public virtual bool IsFieldMatch { get; }
Property Value
Type | Description |
---|---|
System. |
IsPhraseHighlight
return whether phraseHighlight or not.
Declaration
public virtual bool IsPhraseHighlight { get; }
Property Value
Type | Description |
---|---|
System. |
PhraseLimit
Gets or Sets the maximum number of phrases to analyze when searching for the highest-scoring phrase. The default is unlimited (int.MaxValue).
Declaration
public virtual int PhraseLimit { get; set; }
Property Value
Type | Description |
---|---|
System. |
Methods
| Improve this Doc View SourceGetBestFragment(FieldQuery, IndexReader, Int32, String, Int32)
return the best fragment.
Declaration
public string GetBestFragment(FieldQuery fieldQuery, IndexReader reader, int docId, string fieldName, int fragCharSize)
Parameters
Type | Name | Description |
---|---|---|
Field |
fieldQuery | Field |
Index |
reader | |
System. |
docId | document id to be highlighted |
System. |
fieldName | field of the document to be highlighted |
System. |
fragCharSize | the length (number of chars) of a fragment |
Returns
Type | Description |
---|---|
System. |
the best fragment (snippet) string |
GetBestFragment(FieldQuery, IndexReader, Int32, String, Int32, IFragListBuilder, IFragmentsBuilder, String[], String[], IEncoder)
return the best fragment.
Declaration
public string GetBestFragment(FieldQuery fieldQuery, IndexReader reader, int docId, string fieldName, int fragCharSize, IFragListBuilder fragListBuilder, IFragmentsBuilder fragmentsBuilder, string[] preTags, string[] postTags, IEncoder encoder)
Parameters
Type | Name | Description |
---|---|---|
Field |
fieldQuery | Field |
Index |
reader | |
System. |
docId | document id to be highlighted |
System. |
fieldName | field of the document to be highlighted |
System. |
fragCharSize | the length (number of chars) of a fragment |
IFrag |
fragListBuilder | IFrag |
IFragments |
fragmentsBuilder | IFragments |
System. |
preTags | pre-tags to be used to highlight terms |
System. |
postTags | post-tags to be used to highlight terms |
IEncoder | encoder | an encoder that generates encoded text |
Returns
Type | Description |
---|---|
System. |
the best fragment (snippet) string |
GetBestFragments(FieldQuery, IndexReader, Int32, String, ISet<String>, Int32, Int32, IFragListBuilder, IFragmentsBuilder, String[], String[], IEncoder)
Return the best fragments. Matches are scanned from matchedFields
and turned into fragments against
storedField
. The highlighting may not make sense if matchedFields
has matches with offsets that don't
correspond features in storedField
. It will outright throw a matchedFields
produces offsets outside of storedField
. As such it is advisable that all
matchedFields
share the same source as storedField
or are at least a prefix of it.
Declaration
public string[] GetBestFragments(FieldQuery fieldQuery, IndexReader reader, int docId, string storedField, ISet<string> matchedFields, int fragCharSize, int maxNumFragments, IFragListBuilder fragListBuilder, IFragmentsBuilder fragmentsBuilder, string[] preTags, string[] postTags, IEncoder encoder)
Parameters
Type | Name | Description |
---|---|---|
Field |
fieldQuery | Field |
Index |
reader | |
System. |
docId | document id to be highlighted |
System. |
storedField | field of the document that stores the text |
ISet<System. |
matchedFields | fields of the document to scan for matches |
System. |
fragCharSize | the length (number of chars) of a fragment |
System. |
maxNumFragments | maximum number of fragments |
IFrag |
fragListBuilder | IFrag |
IFragments |
fragmentsBuilder | IFragments |
System. |
preTags | pre-tags to be used to highlight terms |
System. |
postTags | post-tags to be used to highlight terms |
IEncoder | encoder | an encoder that generates encoded text |
Returns
Type | Description |
---|---|
System. |
created fragments or null when no fragments created.
size of the array can be less than |
GetBestFragments(FieldQuery, IndexReader, Int32, String, Int32, Int32)
return the best fragments.
Declaration
public string[] GetBestFragments(FieldQuery fieldQuery, IndexReader reader, int docId, string fieldName, int fragCharSize, int maxNumFragments)
Parameters
Type | Name | Description |
---|---|---|
Field |
fieldQuery | Field |
Index |
reader | |
System. |
docId | document id to be highlighted |
System. |
fieldName | field of the document to be highlighted |
System. |
fragCharSize | the length (number of chars) of a fragment |
System. |
maxNumFragments | maximum number of fragments |
Returns
Type | Description |
---|---|
System. |
created fragments or null when no fragments created. size of the array can be less than maxNumFragments |
GetBestFragments(FieldQuery, IndexReader, Int32, String, Int32, Int32, IFragListBuilder, IFragmentsBuilder, String[], String[], IEncoder)
return the best fragments.
Declaration
public string[] GetBestFragments(FieldQuery fieldQuery, IndexReader reader, int docId, string fieldName, int fragCharSize, int maxNumFragments, IFragListBuilder fragListBuilder, IFragmentsBuilder fragmentsBuilder, string[] preTags, string[] postTags, IEncoder encoder)
Parameters
Type | Name | Description |
---|---|---|
Field |
fieldQuery | Field |
Index |
reader | |
System. |
docId | document id to be highlighted |
System. |
fieldName | field of the document to be highlighted |
System. |
fragCharSize | the length (number of chars) of a fragment |
System. |
maxNumFragments | maximum number of fragments |
IFrag |
fragListBuilder | IFrag |
IFragments |
fragmentsBuilder | IFragments |
System. |
preTags | pre-tags to be used to highlight terms |
System. |
postTags | post-tags to be used to highlight terms |
IEncoder | encoder | an encoder that generates encoded text |
Returns
Type | Description |
---|---|
System. |
created fragments or null when no fragments created. size of the array can be less than maxNumFragments |
GetFieldQuery(Query)
create a Field
Declaration
public virtual FieldQuery GetFieldQuery(Query query)
Parameters
Type | Name | Description |
---|---|---|
Query | query | a query |
Returns
Type | Description |
---|---|
Field |
the created Field |
GetFieldQuery(Query, IndexReader)
create a Field
Declaration
public virtual FieldQuery GetFieldQuery(Query query, IndexReader reader)
Parameters
Type | Name | Description |
---|---|---|
Query | query | a query |
Index |
reader |
Returns
Type | Description |
---|---|
Field |
the created Field |