From: Sergey Kartashoff Date: Fri, 2 Mar 2001 11:41:35 +0000 (+0000) Subject: UDM_ISPELL_TYPE_SERVER parameter in udm_load_ispell_data has been added X-Git-Tag: php-4.0.5RC1~115 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8bc7344f0bbdbc2f5ee3f78b27c3c0cf030ca067;p=php UDM_ISPELL_TYPE_SERVER parameter in udm_load_ispell_data has been added to work with ispell server. This feature is available starting from mnoGoSearch 3.1.12 or later. Fixed Udm_Free_Ispell_Data(). Example updated. --- diff --git a/ext/mnogosearch/php_mnogo.c b/ext/mnogosearch/php_mnogo.c index cdc4c72d8f..3032b00239 100644 --- a/ext/mnogosearch/php_mnogo.c +++ b/ext/mnogosearch/php_mnogo.c @@ -643,6 +643,10 @@ DLEXPORT PHP_FUNCTION(udm_load_ispell_data) case UDM_ISPELL_TYPE_AFFIX: Agent->Conf->ispell_mode &= ~UDM_ISPELL_MODE_DB; + +#if UDM_VERSION_ID > 30111 + Agent->Conf->ispell_mode &= ~UDM_ISPELL_MODE_SERVER; +#endif if (UdmImportAffixes(Agent->Conf,val1,val2,NULL,0)) { php_error(E_WARNING,"Udm_Load_Ispell_Data: Cannot load affix file %s",val2); @@ -654,16 +658,28 @@ DLEXPORT PHP_FUNCTION(udm_load_ispell_data) case UDM_ISPELL_TYPE_SPELL: Agent->Conf->ispell_mode &= ~UDM_ISPELL_MODE_DB; +#if UDM_VERSION_ID > 30111 + Agent->Conf->ispell_mode &= ~UDM_ISPELL_MODE_SERVER; +#endif + if (UdmImportDictionary(Agent->Conf,val1,val2,1,"")) { php_error(E_WARNING,"Udm_Load_Ispell_Data: Cannot load spell file %s",val2); RETURN_FALSE; } break; - + +#if UDM_VERSION_ID > 30111 + case UDM_ISPELL_TYPE_SERVER: + Agent->Conf->ispell_mode &= ~UDM_ISPELL_MODE_DB; + Agent->Conf->ispell_mode |= UDM_ISPELL_MODE_SERVER; + + Agent->Conf->spellhost = strdup(val1); break; + +#endif default: php_error(E_WARNING,"Udm_Load_Ispell_Data: Unknown ispell type parameter"); @@ -702,7 +718,9 @@ DLEXPORT PHP_FUNCTION(udm_free_ispell_data) } ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, -1, "mnoGoSearch-Agent", le_link); - /* UdmClearIspellData(Agent->Conf); */ +#if UDM_VERSION_ID > 30111 + UdmFreeIspell(Agent->Conf); +#endif RETURN_TRUE; } diff --git a/ext/mnogosearch/test.php b/ext/mnogosearch/test.php index 57e01be95c..d57e7e6707 100644 --- a/ext/mnogosearch/test.php +++ b/ext/mnogosearch/test.php @@ -59,10 +59,14 @@ // if ((! Udm_Load_Ispell_Data($udm,UDM_ISPELL_TYPE_AFFIX,'en','/opt/udm/ispell/en.aff',0)) || // (! Udm_Load_Ispell_Data($udm,UDM_ISPELL_TYPE_SPELL,'en','/opt/udm/ispell/en.dict',1))) { -// printf("Error #%d: '%s'\n",Udm_Errno($udm),Udm_Error($udm)); +// printf("Error loading ispell data from files
\n"); // exit; // } + if (! Udm_Load_Ispell_Data($udm,UDM_ISPELL_TYPE_SERVER,'','',1)) { + printf("Error loading ispell data from server
\n"); + exit; + } // Stage 3: add search limits // Udm_Add_Search_Limit($udm,UDM_LIMIT_URL,"http://www.mydomain.com/%");