Class FastVectorHighlighter
Another highlighter implementation.
Inherited Members
Namespace: Lucene.Net.Search.VectorHighlight
Assembly: Lucene.Net.Highlighter.dll
Syntax
public class FastVectorHighlighter
Constructors
FastVectorHighlighter()
the default constructor.
Declaration
public FastVectorHighlighter()
FastVectorHighlighter(bool, bool)
a constructor. Using SimpleFragListBuilder and ScoreOrderFragmentsBuilder.
Declaration
public FastVectorHighlighter(bool phraseHighlight, bool fieldMatch)
Parameters
Type | Name | Description |
---|---|---|
bool | phraseHighlight | true or false for phrase highlighting |
bool | fieldMatch | true of false for field matching |
FastVectorHighlighter(bool, bool, IFragListBuilder, IFragmentsBuilder)
a constructor. A IFragListBuilder and a IFragmentsBuilder can be specified (plugins).
Declaration
public FastVectorHighlighter(bool phraseHighlight, bool fieldMatch, IFragListBuilder fragListBuilder, IFragmentsBuilder fragmentsBuilder)
Parameters
Type | Name | Description |
---|---|---|
bool | phraseHighlight | true of false for phrase highlighting |
bool | fieldMatch | true of false for field matching |
IFragListBuilder | fragListBuilder | an instance of IFragmentsBuilder |
IFragmentsBuilder | fragmentsBuilder | an instance of IFragmentsBuilder |
Fields
DEFAULT_FIELD_MATCH
Another highlighter implementation.
Declaration
public static readonly bool DEFAULT_FIELD_MATCH
Field Value
Type | Description |
---|---|
bool |
DEFAULT_PHRASE_HIGHLIGHT
Another highlighter implementation.
Declaration
public static readonly bool DEFAULT_PHRASE_HIGHLIGHT
Field Value
Type | Description |
---|---|
bool |
Properties
IsFieldMatch
return whether fieldMatch or not.
Declaration
public virtual bool IsFieldMatch { get; }
Property Value
Type | Description |
---|---|
bool |
IsPhraseHighlight
return whether phraseHighlight or not.
Declaration
public virtual bool IsPhraseHighlight { get; }
Property Value
Type | Description |
---|---|
bool |
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 |
---|---|
int |
Methods
GetBestFragment(FieldQuery, IndexReader, int, string, int)
return the best fragment.
Declaration
public string GetBestFragment(FieldQuery fieldQuery, IndexReader reader, int docId, string fieldName, int fragCharSize)
Parameters
Type | Name | Description |
---|---|---|
FieldQuery | fieldQuery | FieldQuery object |
IndexReader | reader | Lucene.Net.Index.IndexReader of the index |
int | docId | document id to be highlighted |
string | fieldName | field of the document to be highlighted |
int | fragCharSize | the length (number of chars) of a fragment |
Returns
Type | Description |
---|---|
string | the best fragment (snippet) string |
Exceptions
Type | Condition |
---|---|
IOException | If there is a low-level I/O error |
GetBestFragment(FieldQuery, IndexReader, int, string, int, 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 |
---|---|---|
FieldQuery | fieldQuery | FieldQuery object |
IndexReader | reader | Lucene.Net.Index.IndexReader of the index |
int | docId | document id to be highlighted |
string | fieldName | field of the document to be highlighted |
int | fragCharSize | the length (number of chars) of a fragment |
IFragListBuilder | fragListBuilder | IFragListBuilder object |
IFragmentsBuilder | fragmentsBuilder | IFragmentsBuilder object |
string[] | preTags | pre-tags to be used to highlight terms |
string[] | postTags | post-tags to be used to highlight terms |
IEncoder | encoder | an encoder that generates encoded text |
Returns
Type | Description |
---|---|
string | the best fragment (snippet) string |
Exceptions
Type | Condition |
---|---|
IOException | If there is a low-level I/O error |
GetBestFragments(FieldQuery, IndexReader, int, string, ISet<string>, int, int, 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 IndexOutOfRangeException
if 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 |
---|---|---|
FieldQuery | fieldQuery | FieldQuery object |
IndexReader | reader | Lucene.Net.Index.IndexReader of the index |
int | docId | document id to be highlighted |
string | storedField | field of the document that stores the text |
ISet<string> | matchedFields | fields of the document to scan for matches |
int | fragCharSize | the length (number of chars) of a fragment |
int | maxNumFragments | maximum number of fragments |
IFragListBuilder | fragListBuilder | IFragListBuilder object |
IFragmentsBuilder | fragmentsBuilder | IFragmentsBuilder object |
string[] | preTags | pre-tags to be used to highlight terms |
string[] | postTags | post-tags to be used to highlight terms |
IEncoder | encoder | an encoder that generates encoded text |
Returns
Type | Description |
---|---|
string[] | created fragments or null when no fragments created.
size of the array can be less than |
Exceptions
Type | Condition |
---|---|
IOException | If there is a low-level I/O error |
GetBestFragments(FieldQuery, IndexReader, int, string, int, int)
return the best fragments.
Declaration
public string[] GetBestFragments(FieldQuery fieldQuery, IndexReader reader, int docId, string fieldName, int fragCharSize, int maxNumFragments)
Parameters
Type | Name | Description |
---|---|---|
FieldQuery | fieldQuery | FieldQuery object |
IndexReader | reader | Lucene.Net.Index.IndexReader of the index |
int | docId | document id to be highlighted |
string | fieldName | field of the document to be highlighted |
int | fragCharSize | the length (number of chars) of a fragment |
int | maxNumFragments | maximum number of fragments |
Returns
Type | Description |
---|---|
string[] | created fragments or null when no fragments created. size of the array can be less than maxNumFragments |
Exceptions
Type | Condition |
---|---|
IOException | If there is a low-level I/O error |
GetBestFragments(FieldQuery, IndexReader, int, string, int, int, 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 |
---|---|---|
FieldQuery | fieldQuery | FieldQuery object |
IndexReader | reader | Lucene.Net.Index.IndexReader of the index |
int | docId | document id to be highlighted |
string | fieldName | field of the document to be highlighted |
int | fragCharSize | the length (number of chars) of a fragment |
int | maxNumFragments | maximum number of fragments |
IFragListBuilder | fragListBuilder | IFragListBuilder object |
IFragmentsBuilder | fragmentsBuilder | IFragmentsBuilder object |
string[] | preTags | pre-tags to be used to highlight terms |
string[] | postTags | post-tags to be used to highlight terms |
IEncoder | encoder | an encoder that generates encoded text |
Returns
Type | Description |
---|---|
string[] | created fragments or null when no fragments created. size of the array can be less than maxNumFragments |
Exceptions
Type | Condition |
---|---|
IOException | If there is a low-level I/O error |
GetFieldQuery(Query)
create a FieldQuery object.
Declaration
public virtual FieldQuery GetFieldQuery(Query query)
Parameters
Type | Name | Description |
---|---|---|
Query | query | a query |
Returns
Type | Description |
---|---|
FieldQuery | the created FieldQuery object |
GetFieldQuery(Query, IndexReader)
create a FieldQuery object.
Declaration
public virtual FieldQuery GetFieldQuery(Query query, IndexReader reader)
Parameters
Type | Name | Description |
---|---|---|
Query | query | a query |
IndexReader | reader |
Returns
Type | Description |
---|---|
FieldQuery | the created FieldQuery object |