parcel | Lucy |
class variable | LUCY_HIGHLIGHTER |
struct symbol | lucy_Highlighter |
class nickname | lucy_Highlighter |
header file | Lucy/Highlight/Highlighter.h |
Lucy::Highlight::Highlighter – Create and highlight excerpts.
The Highlighter can be used to select relevant snippets from a document, and to surround search terms with highlighting tags. It handles both stems and phrases correctly and efficiently, using special-purpose data generated at index-time.
lucy_Highlighter* // incremented
lucy_Highlighter_new(
lucy_Searcher *searcher,
cfish_Obj *query,
cfish_String *field,
uint32_t excerpt_length
);
Create a new Highlighter.
An object which inherits from Searcher, such as an IndexSearcher.
Query object or a query string.
The name of the field from which to draw the excerpt. The
field must marked as be highlightable
(see
FieldType).
Maximum length of the excerpt, in characters.
lucy_Highlighter*
lucy_Highlighter_init(
lucy_Highlighter *self,
lucy_Searcher *searcher,
cfish_Obj *query,
cfish_String *field,
uint32_t excerpt_length
);
Initialize a Highlighter.
An object which inherits from Searcher, such as an IndexSearcher.
Query object or a query string.
The name of the field from which to draw the excerpt. The
field must marked as be highlightable
(see
FieldType).
Maximum length of the excerpt, in characters.
cfish_String* // incremented
lucy_Highlighter_Create_Excerpt(
lucy_Highlighter *self,
lucy_HitDoc *hit_doc
);
Take a HitDoc object and return a highlighted excerpt as a string if
the HitDoc has a value for the specified field
.
cfish_String* // incremented
lucy_Highlighter_Encode(
lucy_Highlighter *self,
cfish_String *text
);
Encode text with HTML entities. This method is called internally by Create_Excerpt() for each text fragment when assembling an excerpt. A subclass can override this if the text should be encoded differently or not at all.
cfish_String* // incremented
lucy_Highlighter_Highlight(
lucy_Highlighter *self,
cfish_String *text
);
Highlight a small section of text. By default, prepends pre-tag and appends post-tag. This method is called internally by Create_Excerpt() when assembling an excerpt.
void
lucy_Highlighter_Set_Pre_Tag(
lucy_Highlighter *self,
cfish_String *pre_tag
);
Setter. The default value is “<strong>”.
void
lucy_Highlighter_Set_Post_Tag(
lucy_Highlighter *self,
cfish_String *post_tag
);
Setter. The default value is “</strong>”.
cfish_String*
lucy_Highlighter_Get_Pre_Tag(
lucy_Highlighter *self
);
Accessor.
cfish_String*
lucy_Highlighter_Get_Post_Tag(
lucy_Highlighter *self
);
Accessor.
cfish_String*
lucy_Highlighter_Get_Field(
lucy_Highlighter *self
);
Accessor.
uint32_t
lucy_Highlighter_Get_Excerpt_Length(
lucy_Highlighter *self
);
Accessor.
lucy_Searcher*
lucy_Highlighter_Get_Searcher(
lucy_Highlighter *self
);
Accessor.
lucy_Query*
lucy_Highlighter_Get_Query(
lucy_Highlighter *self
);
Accessor.
lucy_Compiler*
lucy_Highlighter_Get_Compiler(
lucy_Highlighter *self
);
Accessor for the Lucy::Search::Compiler object derived from
query
and searcher
.
Lucy::Highlight::Highlighter is a Clownfish::Obj.
Copyright © 2010-2015 The Apache Software Foundation, Licensed under the
Apache License, Version 2.0.
Apache Lucy, Lucy, Apache, the Apache feather logo, and the Apache Lucy project logo are trademarks of The
Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their
respective owners.