summaryrefslogtreecommitdiff
path: root/ext/mnogosearch
diff options
context:
space:
mode:
authorSergey Kartashoff <gluke@php.net>2003-07-08 14:00:20 +0000
committerSergey Kartashoff <gluke@php.net>2003-07-08 14:00:20 +0000
commit502d59ea0111121ad6c835b9814ab179230b17b0 (patch)
treec03d800e87b63dabe6e3dd46b053f8ed4c2d9620 /ext/mnogosearch
parent64cad72284e98a94565d7ffa6cf6a590f4d62367 (diff)
downloadphp-git-502d59ea0111121ad6c835b9814ab179230b17b0.tar.gz
- Output of UDM_PARAM_WORDINFO_ALL was fixed
Diffstat (limited to 'ext/mnogosearch')
-rw-r--r--ext/mnogosearch/php_mnogo.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/ext/mnogosearch/php_mnogo.c b/ext/mnogosearch/php_mnogo.c
index e1a91c1660..f5e1c3c0f7 100644
--- a/ext/mnogosearch/php_mnogo.c
+++ b/ext/mnogosearch/php_mnogo.c
@@ -2148,8 +2148,9 @@ DLEXPORT PHP_FUNCTION(udm_get_res_param)
*wordinfo = '\0';
for(i = 0; i < Res->WWList.nwords; i++){
- if ((Res->WWList.Word[i].count > 0) || (Res->WWList.Word[i].origin == UDM_WORD_ORIGIN_QUERY)) {
- if(wordinfo[0]) strcat(wordinfo,", ");
+ if ((Res->WWList.Word[i].count > 0) ||
+ (Res->WWList.Word[i].origin == UDM_WORD_ORIGIN_QUERY)) {
+ if(wordinfo[0]) strcat(wordinfo,", ");
sprintf(UDM_STREND(wordinfo)," %s : %d", Res->WWList.Word[i].word, Res->WWList.Word[i].count);
} else if (Res->WWList.Word[i].origin == UDM_WORD_ORIGIN_STOP) {
if(wordinfo[0]) strcat(wordinfo,", ");
@@ -2167,7 +2168,7 @@ DLEXPORT PHP_FUNCTION(udm_get_res_param)
#if UDM_VERSION_ID >= 30204
case UDM_PARAM_WORDINFO_ALL:
{
- int len,i;
+ int len,i,j;
for(len = i = 0; i < Res->WWList.nwords; i++)
len += Res->WWList.Word[i].len;
{
@@ -2177,23 +2178,19 @@ DLEXPORT PHP_FUNCTION(udm_get_res_param)
*wordinfo = '\0';
- for(i = 0; i < Res->WWList.nwords; i++){
- if (Res->WWList.Word[i].order != corder) {
- if(wordinfo[0]) {
- sprintf(UDM_STREND(wordinfo)," / %d, ", ccount);
- }
- ccount = Res->WWList.Word[i].count;
- if (Res->WWList.Word[i].origin == UDM_WORD_ORIGIN_STOP) {
- sprintf(UDM_STREND(wordinfo)," %s : stopword", Res->WWList.Word[i].word);
- } else {
- sprintf(UDM_STREND(wordinfo)," %s : %d", Res->WWList.Word[i].word, Res->WWList.Word[i].count);
- corder = Res->WWList.Word[i].order;
- }
- } else {
- ccount += Res->WWList.Word[i].count;
+ for(i = 0; i < Res->WWList.nwords; i++) {
+ corder = Res->WWList.Word[i].order;
+ ccount = 0;
+ for(j = 0; j < Res->WWList.nwords; j++) {
+ if (Res->WWList.Word[j].order == corder) {
+ ccount += Res->WWList.Word[j].count;
+ }
}
- }
- if (Res->WWList.nwords) {
+ if (Res->WWList.Word[i].origin == UDM_WORD_ORIGIN_STOP) {
+ sprintf(UDM_STREND(wordinfo),"%s%s : stopword", (*wordinfo) ? ", " : "", Res->WWList.Word[i].word);
+ } else if (Res->WWList.Word[i].origin == UDM_WORD_ORIGIN_QUERY) {
+ sprintf(UDM_STREND(wordinfo),"%s%s : %d", (*wordinfo) ? ", " : "", Res->WWList.Word[i].word, Res->WWList.Word[i].count);
+ } else continue;
sprintf(UDM_STREND(wordinfo)," / %d", ccount);
}
RETURN_STRING(wordinfo,1);