]> granicus.if.org Git - php/commitdiff
Added UDM_PARAM_FIRST_DOC and UDM_PARAM_LAST_DOC mnoGoSearch extenstion
authorSergey Kartashoff <gluke@php.net>
Fri, 9 Feb 2001 13:29:20 +0000 (13:29 +0000)
committerSergey Kartashoff <gluke@php.net>
Fri, 9 Feb 2001 13:29:20 +0000 (13:29 +0000)
result parameters. Example updated.

ext/mnogosearch/php_mnogo.c
ext/mnogosearch/test.php

index 758faac4dcb6d27ff81d6df1d737e8b5aebfb20a..7c1246fb51369f67653a32d09e47fed3a54f4ca5 100644 (file)
@@ -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");
index b44c9103c9be85863ad8c5d79177bb7efa6fbd85..916f5dd2d9ac959f5d2ff099de1adbbafa5d5828 100644 (file)
                $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++){