The interface that an external prefilter library must implement to perform document prefiltering for full text index population or updating.
typedef struct a_text_source { a_sql_uint32 ( SQL_CALLBACK *begin_document )( a_text_source *This ); a_sql_uint32 ( SQL_CALLBACK *get_next_piece )( a_text_source *This , unsigned char ** buffer , a_sql_uint32* len ); a_sql_uint32 ( SQL_CALLBACK *end_document )( a_text_source *This); a_sql_uint64 ( SQL_CALLBACK *get_document_size )( a_text_source *This ); a_sql_uint32 ( SQL_CALLBACK *fini_all )( a_text_source *This ); a_server_context *_context; // Only one of the following two members can have a valid pointer in a given implementation. // These members point to the current module's producer a_text_source *_my_text_producer; a_word_source *_my_word_source; // Following members have been reserved for // future use ONLY a_text_source *_my_text_consumer; a_word_source *_my_word_consumer; } a_text_source; |
Member | Type | Description |
---|---|---|
begin_document | a_sql_uint32 |
Performs the necessary setup steps for processing a document. This method returns 0 on success, and 1 if an error occurred or if no more documents are available. |
get_next_piece | a_sql_uint32 |
Returns a fragment of the filtered input byte stream along with the length of the fragment. This method will be called multiple times for a given document, and should return subsequent chunks of the document at each call until all the input data for a document is consumed, or an error occurs. buffer is the OUT parameter to be populated by the prefilter to point to the produced data. Memory is managed by the prefilter. len is the OUT parameter indicating the length of the produced data. |
end_document | a_sql_uint32 |
Marks completion of filtering for the given document, and performs document-specific cleanup, if necessary. |
get_document_size | a_sql_uint64 |
Returns the total length of the document (in bytes) as produced by the prefilter. The a_text_source object must keep a current count of the total number of bytes produced by it so far for the current document. |
fini_all | a_sql_uint32 |
Called by the database server after the processing of all the documents is done and the pipeline is about to be closed. fini_all performs the final cleanup steps. |
_context | a_server_context * |
Use this member to hold the database server context that is provided to the entry point function within the a_init_pre_filter structure. The prefilter module uses this context to establish direct communication with the database server. |
_my_text_producer | a_text_source * |
Use this member to store the pointer to the a_text_source producer of the prefilter that is provided to the entry point function within the a_init_pre_filter structure. This pointer may be replaced by the database server after the entry point function has been executed if character set conversion is required. Therefore, only this pointer to the text producer can be used by the prefilter. |
_my_word_producer | a_word_source * |
Reserved for future use and should be initialized to NULL. |
_my_text_consumer | a_text_source * |
Reserved for future use and should be initialized to NULL. |
_my_word_consumer | a_word_source * |
Reserved for future use and should be initialized to NULL. |
The a_text_source interface is stream-based-data. The data is pulled from the producer in sequence; each byte is only seen once.
The a_text_source interface is defined by a header file named extpfapiv1.h, in the SDK\Include subdirectory of your SQL Anywhere installation directory.
The external library should not be holding any operating system synchronization primitives across function calls.
Discuss this page in DocCommentXchange.
|
Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1 |