summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Kartashoff <gluke@php.net>2001-02-09 13:29:20 +0000
committerSergey Kartashoff <gluke@php.net>2001-02-09 13:29:20 +0000
commit279588aa120124113f297b4211395b93db549620 (patch)
tree0da683133b62e9bb403d2f5ef703f7b16a813aed
parente0b2a5f58373ed8e6f2f53132a8fe142c3101692 (diff)
downloadphp-git-279588aa120124113f297b4211395b93db549620.tar.gz
Added UDM_PARAM_FIRST_DOC and UDM_PARAM_LAST_DOC mnoGoSearch extenstion
result parameters. Example updated.
-rw-r--r--ext/mnogosearch/php_mnogo.c12
-rw-r--r--ext/mnogosearch/test.php6
2 files changed, 16 insertions, 2 deletions
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++){