cvs: php4 /ext/mnogosearch php_mnogo.c php_mnogo.h

From: Date: Sat, 01 Dec 2001 14:05:15 +0000
Subject: cvs: php4 /ext/mnogosearch php_mnogo.c php_mnogo.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-8344@lists.php.net to get a copy of this message
gluke Sat Dec 1 09:05:15 2001 EDT Modified files: /php4/ext/mnogosearch php_mnogo.c php_mnogo.h Log: - StoreDOC support has been added to mnogoSearch module. Index: php4/ext/mnogosearch/php_mnogo.c diff -u php4/ext/mnogosearch/php_mnogo.c:1.43 php4/ext/mnogosearch/php_mnogo.c:1.44 --- php4/ext/mnogosearch/php_mnogo.c:1.43 Mon Nov 5 14:07:24 2001 +++ php4/ext/mnogosearch/php_mnogo.c Sat Dec 1 09:05:12 2001 @@ -1,5 +1,5 @@ /* $Source: /usr/repository/php4/ext/mnogosearch/php_mnogo.c,v $ */ -/* $Id: php_mnogo.c,v 1.43 2001/11/05 19:07:24 gluke Exp $ */ +/* $Id: php_mnogo.c,v 1.44 2001/12/01 14:05:12 gluke Exp $ */ /* +----------------------------------------------------------------------+ @@ -49,6 +49,8 @@ #define UDM_FIELD_ORDER 11 #define UDM_FIELD_CRC 12 #define UDM_FIELD_CATEGORY 13 +#define UDM_FIELD_LANG 14 +#define UDM_FIELD_CHARSET 15 /* udm_set_agent_param constants */ #define UDM_PARAM_PAGE_SIZE 1 @@ -133,6 +135,10 @@ PHP_FE(udm_check_charset, NULL) #endif +#if UDM_VERSION_ID >= 30203 + PHP_FE(udm_crc32, NULL) +#endif + PHP_FE(udm_alloc_agent, NULL) PHP_FE(udm_set_agent_param, NULL) @@ -217,6 +223,8 @@ REGISTER_LONG_CONSTANT("UDM_FIELD_ORDER", UDM_FIELD_ORDER,CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("UDM_FIELD_CRC", UDM_FIELD_CRC,CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("UDM_FIELD_CATEGORY", UDM_FIELD_CATEGORY,CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("UDM_FIELD_LANG", UDM_FIELD_LANG,CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("UDM_FIELD_CHARSET", UDM_FIELD_CHARSET,CONST_CS | CONST_PERSISTENT); /* udm_set_agent_param constants */ REGISTER_LONG_CONSTANT("UDM_PARAM_PAGE_SIZE", UDM_PARAM_PAGE_SIZE,CONST_CS | CONST_PERSISTENT); @@ -1019,7 +1027,7 @@ } /* }}} */ -#if UDM_VERSION_ID >= 30200 +#if UDM_VERSION_ID >= 30200 /* {{{ proto int udm_check_charset(int agent, string charset) Check if the given charset is known to mnogosearch */ DLEXPORT PHP_FUNCTION(udm_check_charset) @@ -1052,6 +1060,42 @@ /* }}} */ #endif +#if UDM_VERSION_ID >= 30203 +/* {{{ proto int udm_crc32(int agent, string str) + Return CRC32 checksum of gived string */ +DLEXPORT PHP_FUNCTION(udm_crc32) +{ + pval ** yystr, ** yyagent; + char *str; + int crc32; + char buf[32]; + UDM_AGENT * Agent; + int id=-1; + + switch(ZEND_NUM_ARGS()){ + case 2: { + if (zend_get_parameters_ex(2, &yyagent,&yystr)==FAILURE) { + RETURN_FALSE; + } + } + break; + default: + WRONG_PARAM_COUNT; + break; + } + ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, id, "mnoGoSearch-Agent", le_link); + convert_to_string_ex(yystr); + str = Z_STRVAL_PP(yystr); + + crc32=UdmCRC32((str),strlen(str)); + snprintf(buf,sizeof(buf)-1,"%u",crc32); + + RETURN_STRING(buf,1); +} +/* }}} */ +#endif + + /* {{{ proto int udm_find(int agent, string query) Perform search */ DLEXPORT PHP_FUNCTION(udm_find) @@ -1165,6 +1209,16 @@ case UDM_FIELD_CATEGORY: RETURN_STRING((Res->Doc[row].category)?(Res->Doc[row].category):"",1); break; + +#if UDM_VERSION_ID >= 30203 + case UDM_FIELD_LANG: + RETURN_STRING((Res->Doc[row].lang)?(Res->Doc[row].lang):"",1); + break; + + case UDM_FIELD_CHARSET: + RETURN_STRING((Res->Doc[row].charset)?(Res->Doc[row].charset):"",1); + break; +#endif default: php_error(E_WARNING,"Udm_Get_Res_Field: Unknown mnoGoSearch field name"); Index: php4/ext/mnogosearch/php_mnogo.h diff -u php4/ext/mnogosearch/php_mnogo.h:1.11 php4/ext/mnogosearch/php_mnogo.h:1.12 --- php4/ext/mnogosearch/php_mnogo.h:1.11 Mon Nov 5 14:07:24 2001 +++ php4/ext/mnogosearch/php_mnogo.h Sat Dec 1 09:05:12 2001 @@ -1,5 +1,5 @@ /* $Source: /usr/repository/php4/ext/mnogosearch/php_mnogo.h,v $ */ -/* $Id: php_mnogo.h,v 1.11 2001/11/05 19:07:24 gluke Exp $ */ +/* $Id: php_mnogo.h,v 1.12 2001/12/01 14:05:12 gluke Exp $ */ /* +----------------------------------------------------------------------+ @@ -30,6 +30,10 @@ #include <udm_config.h> #include <udmsearch.h> +#if UDM_VERSION_ID >= 30203 +#include <udm_crc32.h> +#endif + extern zend_module_entry mnogosearch_module_entry; #define mnogosearch_module_ptr &mnogosearch_module_entry @@ -52,6 +56,10 @@ DLEXPORT PHP_FUNCTION(udm_api_version); #if UDM_VERSION_ID >= 30200 DLEXPORT PHP_FUNCTION(udm_check_charset); +#endif + +#if UDM_VERSION_ID >= 30203 +DLEXPORT PHP_FUNCTION(udm_crc32); #endif DLEXPORT PHP_FUNCTION(udm_alloc_agent);

« previous php.cvs (#8344) next »