mirror of
https://github.com/php/php-src.git
synced 2024-11-26 03:16:33 +08:00
- Added synonym stuff support to mnogosearch module. Slightly changed
stored API. Example updated.
This commit is contained in:
parent
3c01151a08
commit
77111db912
@ -43,6 +43,8 @@ $spell_file['en']='/opt/udm/ispell/en.dict';
|
||||
// $spell_file['ru']='/opt/udm/ispell/ru.dict';
|
||||
$stopwordtable_arr[]='stopword';
|
||||
// $stopwordfile_arr[]='stopwords.txt';
|
||||
$synonym_arr[]='/opt/udm/synonym/english.syn';
|
||||
|
||||
$minwordlength=1;
|
||||
$maxwordlength=32;
|
||||
|
||||
@ -593,6 +595,14 @@ function make_nav($query_orig){
|
||||
}
|
||||
}
|
||||
|
||||
if (Udm_Api_Version() >= 30203) {
|
||||
for ($i=0; $i < count($synonym_arr); $i++) {
|
||||
if ($synonym_arr[$i] != '') {
|
||||
Udm_Set_Agent_Param($udm_agent,UDM_PARAM_SYNONYM,$synonym_arr[$i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($m=='any') {
|
||||
Udm_Set_Agent_Param($udm_agent,UDM_PARAM_SEARCH_MODE,UDM_MODE_ANY);
|
||||
} elseif ($m=='all') {
|
||||
|
@ -73,6 +73,7 @@
|
||||
#define UDM_PARAM_BROWSER_CHARSET 18
|
||||
#define UDM_PARAM_HLBEG 19
|
||||
#define UDM_PARAM_HLEND 20
|
||||
#define UDM_PARAM_SYNONYM 21
|
||||
|
||||
/* udm_add_search_limit constants */
|
||||
#define UDM_LIMIT_URL 1
|
||||
@ -259,7 +260,7 @@ DLEXPORT PHP_MINIT_FUNCTION(mnogosearch)
|
||||
REGISTER_LONG_CONSTANT("UDM_PARAM_ISPELL_PREFIX",UDM_PARAM_ISPELL_PREFIXES,CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("UDM_PARAM_PREFIXES", UDM_PARAM_ISPELL_PREFIXES,CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("UDM_PARAM_PREFIX", UDM_PARAM_ISPELL_PREFIXES,CONST_CS | CONST_PERSISTENT);
|
||||
|
||||
|
||||
REGISTER_LONG_CONSTANT("UDM_PARAM_CROSS_WORDS", UDM_PARAM_CROSS_WORDS,CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("UDM_PARAM_CROSSWORDS", UDM_PARAM_CROSS_WORDS,CONST_CS | CONST_PERSISTENT);
|
||||
|
||||
@ -269,6 +270,8 @@ DLEXPORT PHP_MINIT_FUNCTION(mnogosearch)
|
||||
REGISTER_LONG_CONSTANT("UDM_PARAM_HLBEG", UDM_PARAM_HLBEG,CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("UDM_PARAM_HLEND", UDM_PARAM_HLEND,CONST_CS | CONST_PERSISTENT);
|
||||
|
||||
REGISTER_LONG_CONSTANT("UDM_PARAM_SYNONYM", UDM_PARAM_SYNONYM,CONST_CS | CONST_PERSISTENT);
|
||||
|
||||
/* udm_add_search_limit constants */
|
||||
REGISTER_LONG_CONSTANT("UDM_LIMIT_CAT", UDM_LIMIT_CAT,CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("UDM_LIMIT_URL", UDM_LIMIT_URL,CONST_CS | CONST_PERSISTENT);
|
||||
@ -683,6 +686,13 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param)
|
||||
UdmReplaceStrVar(Agent->Conf->vars,"HlBeg",val,UDM_VARSRC_GLOBAL);
|
||||
|
||||
break;
|
||||
|
||||
case UDM_PARAM_SYNONYM:
|
||||
if (UdmSynonymListLoad(Agent->Conf,val)) {
|
||||
php_error(E_WARNING,Agent->Conf->errstr);
|
||||
RETURN_FALSE;
|
||||
} else UdmSynonymListSort(&(Agent->Conf->SynList));
|
||||
break;
|
||||
#endif
|
||||
|
||||
case UDM_PARAM_STOPTABLE:
|
||||
|
Loading…
Reference in New Issue
Block a user