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