cvs: php4 /ext/mnogosearch php_mnogo.c
| From: | Sergey Kartashoff | Date: | Wed, 05 Jun 2002 14:34:55 +0000 |
| Subject: | cvs: php4 /ext/mnogosearch php_mnogo.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-12233@lists.php.net to get a copy of this message | ||
gluke Wed Jun 5 10:34:55 2002 EDT
Modified files:
/php4/ext/mnogosearch php_mnogo.c
Log:
# mnogosearch work continued
Index: php4/ext/mnogosearch/php_mnogo.c
diff -u php4/ext/mnogosearch/php_mnogo.c:1.52 php4/ext/mnogosearch/php_mnogo.c:1.53
--- php4/ext/mnogosearch/php_mnogo.c:1.52 Wed Jun 5 09:06:55 2002
+++ php4/ext/mnogosearch/php_mnogo.c Wed Jun 5 10:34:53 2002
@@ -1,5 +1,5 @@
/* $Source: /usr/repository/php4/ext/mnogosearch/php_mnogo.c,v $ */
-/* $Id: php_mnogo.c,v 1.52 2002/06/05 13:06:55 gluke Exp $ */
+/* $Id: php_mnogo.c,v 1.53 2002/06/05 14:34:53 gluke Exp $ */
/*
+----------------------------------------------------------------------+
@@ -1078,10 +1078,17 @@
}
if (flag) {
+#if UDM_VERSION_ID >= 30204
+ if(Agent->Conf->Spells.nspell) {
+ UdmSortDictionary(&Agent->Conf->Spells);
+ UdmSortAffixes(&Agent->Conf->Affixes,&Agent->Conf->Spells);
+ }
+#else
if(Agent->Conf->nspell) {
UdmSortDictionary(Agent->Conf);
UdmSortAffixes(Agent->Conf);
}
+#endif
}
RETURN_TRUE;
@@ -1106,8 +1113,11 @@
break;
}
ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, -1, "mnoGoSearch-Agent", le_link);
-
-#if UDM_VERSION_ID > 30111
+
+#if UDM_VERSION_ID >= 30204
+ UdmSpellListFree(&Agent->Conf->Spells);
+ UdmAffixListFree(&Agent->Conf->Affixes);
+#elif UDM_VERSION_ID > 30111
UdmFreeIspell(Agent->Conf);
#endif
@@ -1145,26 +1155,40 @@
switch(var){
case UDM_LIMIT_URL:
+#if UDM_VERSION_ID >= 30204
+ UdmVarListAddStr(&Agent->Conf->Vars,"ul",val);
+#else
UdmAddURLLimit(Agent->Conf,val);
-
+#endif
break;
case UDM_LIMIT_TAG:
+#if UDM_VERSION_ID >= 30204
+ UdmVarListAddStr(&Agent->Conf->Vars,"t",val);
+#else
UdmAddTagLimit(Agent->Conf,val);
-
+#endif
break;
case UDM_LIMIT_LANG:
+#if UDM_VERSION_ID >= 30204
+ UdmVarListAddStr(&Agent->Conf->Vars,"lang",val);
+#else
UdmAddLangLimit(Agent->Conf,val);
-
+#endif
break;
case UDM_LIMIT_CAT:
+#if UDM_VERSION_ID >= 30204
+ UdmVarListAddStr(&Agent->Conf->Vars,"cat",val);
+#else
UdmAddCatLimit(Agent->Conf,val);
-
+#endif
break;
- case UDM_LIMIT_DATE: {
+ case UDM_LIMIT_DATE:
+#if UDM_VERSION_ID < 30200
+ {
struct udm_stl_info_t stl_info = { 0, 0, 0 };
if (val[0] == '>') {
@@ -1178,9 +1202,9 @@
stl_info.t1=(time_t)(atol(val+1));
UdmAddTimeLimit(Agent->Conf,&stl_info);
-
- break;
}
+#endif
+ break;
default:
php_error(E_WARNING,"Udm_Add_Search_Limit: Unknown search limit parameter");
RETURN_FALSE;
@@ -1196,6 +1220,8 @@
{
pval ** yyagent;
UDM_AGENT * Agent;
+ int i;
+
switch(ZEND_NUM_ARGS()){
case 1: {
if (zend_get_parameters_ex(1, &yyagent)==FAILURE) {
@@ -1208,9 +1234,20 @@
break;
}
ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, -1, "mnoGoSearch-Agent", le_link);
-
+#if UDM_VERSION_ID >= 30204
+ for(i=0;i<Agent->Conf->Vars.nvars;i++){
+ if ((!strcasecmp("ul",Agent->Conf->Vars.Var[i].name))||
+ (!strcasecmp("cat",Agent->Conf->Vars.Var[i].name))||
+ (!strcasecmp("t",Agent->Conf->Vars.Var[i].name))||
+ (!strcasecmp("lang",Agent->Conf->Vars.Var[i].name))) {
+ UDM_FREE(Agent->Conf->Vars.Var[i].name);
+ UDM_FREE(Agent->Conf->Vars.Var[i].val);
+ Agent->Conf->Vars.nvars--;
+ }
+ }
+#else
UdmClearLimits(Agent->Conf);
-
+#endif
RETURN_TRUE;
}
/* }}} */