diff options
author | Sergey Kartashoff <gluke@php.net> | 2003-07-08 14:00:20 +0000 |
---|---|---|
committer | Sergey Kartashoff <gluke@php.net> | 2003-07-08 14:00:20 +0000 |
commit | 502d59ea0111121ad6c835b9814ab179230b17b0 (patch) | |
tree | c03d800e87b63dabe6e3dd46b053f8ed4c2d9620 /ext/mnogosearch | |
parent | 64cad72284e98a94565d7ffa6cf6a590f4d62367 (diff) | |
download | php-git-502d59ea0111121ad6c835b9814ab179230b17b0.tar.gz |
- Output of UDM_PARAM_WORDINFO_ALL was fixed
Diffstat (limited to 'ext/mnogosearch')
-rw-r--r-- | ext/mnogosearch/php_mnogo.c | 35 |
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); |