外部术语断开器必须实现以便为全文索引操作执行术语断开的接口。
typedef struct a_word_source { a_sql_uint32 ( SQL_CALLBACK *begin_document )( a_word_source *This , a_sql_uint32 has_prefix ); a_sql_uint32 ( SQL_CALLBACK *get_words )( a_word_source *This , a_term** words ,a_sql_uint32 *num_words ); a_sql_uint32 ( SQL_CALLBACK *end_document )( a_word_source *This ); a_sql_uint32 ( SQL_CALLBACK *fini_all )( a_word_source *This ); a_server_context *_context; // Only one of the following pointers can be valid // in any implementation. // For example: if the producer for this module is // a a_text_source, then only my_text_producer will // be a valid pointer whereas my_word_producer // should be assigned a NULL a_text_source *_my_text_producer; a_word_source *_my_word_producer; // Following members have been reserved for // future use ONLY a_text_source *_my_text_consumer; a_word_source *_my_word_consumer; } a_word_source; |
成员 | 类型 | 说明 |
---|---|---|
begin_document | a_sql_uint32 |
执行处理文档所需的必要设置步骤。如果要标识的文档是前缀查询术语,参数 has_prefix 设置为 1、非真或者 TRUE。如果 has_prefix 设置为 TRUE,则术语断开器必须返回至少一个术语(可能为空)。 如果管道初始化的目的是 TERM_BREAKER_FOR_QUERY,has_prefix 只能是 1、非真或者 TRUE。 前缀标识化的结果被视为最后一个术语是短语的实际前缀字符串。 |
get_words | a_sql_uint32 |
返回指向 a_term 结构数组的指针。在循环中为给定文档调用该方法,直到文档的所有内容都已标识为术语。 数据库服务器期望文档中两个连续术语的位置差为 1。如果术语断开器执行其自己的非索引字表处理,则返回的两个连续术语之间的位置差可能会大于 1,这在预料之中,可以接受。但是,在其它情况下,如果数字不连续(即位置相差为 1),指定的位置都可影响执行全文查询的方式,并可对后续全文查询造成不可预期的结果。 |
end_document | a_sql_uint32 |
标记管道文档处理完成,并执行文档特定的清除。 |
fini_all | a_sql_uint32 |
由数据库服务器在处理完所有文档且即将关闭管道时调用。fini_all 执行最终清除步骤。 |
_context | a_server_context * |
在 a_init_term_breaker 结构中提供给入口点函数的数据库服务器环境。术语断开器模块使用该环境建立与数据库服务器的直接通信。 |
_my_text_producer | a_text_source * |
指向在 a_init_term_breaker 结构中提供给入口点函数的术语断开器的 a_text_source 创建器的指针。如果需要字符集转换,则该指针可能会在执行入口点函数后被数据库服务器替换。因此,术语断开器只能使用指向文本创建器的该指针。 |
_my_word_producer | a_word_source * |
留作将来使用并且应该初始化为 NULL。 |
_my_text_consumer | a_text_source * |
留作将来使用并且应该初始化为 NULL。 |
_my_word_consumer | a_word_source * |
留作将来使用并且应该初始化为 NULL。 |
a_word_source 接口由 SQL Anywhere 安装目录 SDK\Include 子目录中名为 exttbapiv1.h 的头文件定义。
外部库不应保有函数调用间的任何操作系统同步基元。
![]() |
使用DocCommentXchange讨论此页。
|
版权 © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1 |