From: Sergey Kartashoff Date: Fri, 9 Feb 2001 13:29:20 +0000 (+0000) Subject: Added UDM_PARAM_FIRST_DOC and UDM_PARAM_LAST_DOC mnoGoSearch extenstion X-Git-Tag: php-4.0.5RC1~323 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=279588aa120124113f297b4211395b93db549620;p=php Added UDM_PARAM_FIRST_DOC and UDM_PARAM_LAST_DOC mnoGoSearch extenstion result parameters. Example updated. --- diff --git a/ext/mnogosearch/php_mnogo.c b/ext/mnogosearch/php_mnogo.c index 758faac4dc..7c1246fb51 100644 --- a/ext/mnogosearch/php_mnogo.c +++ b/ext/mnogosearch/php_mnogo.c @@ -67,6 +67,8 @@ #define UDM_PARAM_FOUND 257 #define UDM_PARAM_WORDINFO 258 #define UDM_PARAM_SEARCHTIME 259 +#define UDM_PARAM_FIRST_DOC 260 +#define UDM_PARAM_LAST_DOC 261 /* True globals, no need for thread safety */ static int le_link,le_res; @@ -167,6 +169,8 @@ DLEXPORT PHP_MINIT_FUNCTION(mnogosearch) REGISTER_LONG_CONSTANT("UDM_PARAM_WORD_INFO", UDM_PARAM_WORDINFO,CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("UDM_PARAM_SEARCHTIME", UDM_PARAM_SEARCHTIME,CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("UDM_PARAM_SEARCH_TIME", UDM_PARAM_SEARCHTIME,CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("UDM_PARAM_FIRST_DOC", UDM_PARAM_FIRST_DOC,CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("UDM_PARAM_LAST_DOC", UDM_PARAM_LAST_DOC,CONST_CS | CONST_PERSISTENT); /* search modes */ REGISTER_LONG_CONSTANT("UDM_MODE_ALL", UDM_MODE_ALL,CONST_CS | CONST_PERSISTENT); @@ -635,6 +639,14 @@ DLEXPORT PHP_FUNCTION(udm_get_res_param) case UDM_PARAM_SEARCHTIME: RETURN_DOUBLE(((double)Res->work_time)/1000); break; + + case UDM_PARAM_FIRST_DOC: + RETURN_LONG(Res->first); + break; + + case UDM_PARAM_LAST_DOC: + RETURN_LONG(Res->last); + break; default: php_error(E_WARNING,"Udm_Get_Res_Param: Unknown mnoGoSearch param name"); diff --git a/ext/mnogosearch/test.php b/ext/mnogosearch/test.php index b44c9103c9..916f5dd2d9 100644 --- a/ext/mnogosearch/test.php +++ b/ext/mnogosearch/test.php @@ -64,11 +64,13 @@ $rows=Udm_Get_Res_Param($res,UDM_PARAM_NUM_ROWS); $wordinfo=Udm_Get_Res_Param($res,UDM_PARAM_WORDINFO); $searchtime=Udm_Get_Res_Param($res,UDM_PARAM_SEARCHTIME); + $first_doc=Udm_Get_Res_Param($res,UDM_PARAM_FIRST_DOC); + $last_doc=Udm_Get_Res_Param($res,UDM_PARAM_LAST_DOC); printf("Searchtime: ".$searchtime."\n\n"); - printf("Documents %d-%d from %d total found; %s\n\n", - $first,$first+$rows-1,$total,$wordinfo); + printf("Documents %d(%d)-%d(%d) from %d total found; %s\n\n", + $first,$first_doc,$first+$rows-1,$last_doc,$total,$wordinfo); // Fetch all rows for($i=0;$i<$rows;$i++){