Method GetBestFragments
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 |
IndexReader | reader | |
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 |
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 |
IndexReader | reader | |
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 |
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 |
---|---|---|
FieldQuery | fieldQuery | FieldQuery object |
IndexReader | reader | |
System.Int32 | docId | document id to be highlighted |
System.String | storedField | field of the document that stores the text |
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 |