Added thow new mnoGoSearch agent session parameters:

UDM_PARAM_WEIGHT_FACTOR and UDM_PARAM_WORD_MATCH.
This commit is contained in:
Sergey Kartashoff 2001-02-15 11:50:49 +00:00
parent 637e8e14aa
commit cd55dfa3bd
2 changed files with 44 additions and 0 deletions

View File

@ -52,6 +52,8 @@
#define UDM_PARAM_CHARSET 6
#define UDM_PARAM_STOPTABLE 7
#define UDM_PARAM_STOPFILE 8
#define UDM_PARAM_WEIGHT_FACTOR 9
#define UDM_PARAM_WORD_MATCH 10
/* udm_add_search_limit constants */
#define UDM_LIMIT_URL 1
@ -59,6 +61,7 @@
#define UDM_LIMIT_LANG 3
#define UDM_LIMIT_CAT 4
/* track modes */
#define UDM_TRACK_ENABLED 1
#define UDM_TRACK_DISABLED 0
@ -155,6 +158,8 @@ DLEXPORT PHP_MINIT_FUNCTION(mnogosearch)
REGISTER_LONG_CONSTANT("UDM_PARAM_STOP_TABLE", UDM_PARAM_STOPTABLE,CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("UDM_PARAM_STOPFILE", UDM_PARAM_STOPFILE,CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("UDM_PARAM_STOP_FILE", UDM_PARAM_STOPFILE,CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("UDM_PARAM_WEIGHT_FACTOR",UDM_PARAM_WEIGHT_FACTOR,CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("UDM_PARAM_WORD_MATCH", UDM_PARAM_WORD_MATCH,CONST_CS | CONST_PERSISTENT);
/* udm_add_search_limit constants */
REGISTER_LONG_CONSTANT("UDM_LIMIT_CAT", UDM_LIMIT_CAT,CONST_CS | CONST_PERSISTENT);
@ -184,6 +189,12 @@ DLEXPORT PHP_MINIT_FUNCTION(mnogosearch)
/* track mode params */
REGISTER_LONG_CONSTANT("UDM_TRACK_ENABLED", UDM_TRACK_ENABLED,CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("UDM_TRACK_DISABLED", UDM_TRACK_DISABLED,CONST_CS | CONST_PERSISTENT);
/* word match mode params */
REGISTER_LONG_CONSTANT("UDM_MATCH_WORD", UDM_MATCH_WORD,CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("UDM_MATCH_BEGIN", UDM_MATCH_BEGIN,CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("UDM_MATCH_SUBSTR", UDM_MATCH_SUBSTR,CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("UDM_MATCH_END", UDM_MATCH_END,CONST_CS | CONST_PERSISTENT);
return SUCCESS;
}
@ -330,6 +341,32 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param)
}
break;
case UDM_PARAM_WORD_MATCH:
switch (atoi(val)){
case UDM_MATCH_WORD:
Agent->word_match=UDM_MATCH_WORD;
break;
case UDM_MATCH_BEGIN:
Agent->word_match=UDM_MATCH_BEGIN;
break;
case UDM_MATCH_END:
Agent->word_match=UDM_MATCH_END;
break;
case UDM_MATCH_SUBSTR:
Agent->word_match=UDM_MATCH_SUBSTR;
break;
default:
php_error(E_WARNING,"Udm_Set_Agent_Param: Unknown word match mode");
RETURN_FALSE;
break;
}
break;
case UDM_PARAM_CACHE_MODE:
switch (atoi(val)){
@ -388,6 +425,11 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param)
break;
case UDM_PARAM_WEIGHT_FACTOR:
Agent->weight_factor=strdup(val);
break;
default:
php_error(E_WARNING,"Udm_Set_Agent_Param: Unknown agent session parameter");
RETURN_FALSE;

View File

@ -37,6 +37,8 @@
Udm_Set_Agent_Param($udm,UDM_PARAM_CHARSET,"koi8-r");
// Udm_Set_Agent_Param($udm,UDM_PARAM_STOPTABLE,"stopword");
// Udm_Set_Agent_Param($udm,UDM_PARAM_STOPFILE,"stop.txt");
Udm_Set_Agent_Param($udm,UDM_PARAM_WEIGHT_FACTOR,"F9421");
Udm_Set_Agent_Param($udm,UDM_PARAM_WORD_MATCH,UDM_MATCH_SUBSTR);
// Stage 3: add search limits
// Udm_Add_Search_Limit($udm,UDM_LIMIT_URL,"http://www.mydomain.com/%");