]> granicus.if.org Git - postgresql/commitdiff
Add sanity check of query
authorTeodor Sigaev <teodor@sigaev.ru>
Mon, 31 Oct 2005 13:47:09 +0000 (13:47 +0000)
committerTeodor Sigaev <teodor@sigaev.ru>
Mon, 31 Oct 2005 13:47:09 +0000 (13:47 +0000)
contrib/tsearch2/rank.c

index 40bec1f48407be28356ef0c60313e144f755ed39..445898eff69a74a58bbfb7b5a3b45d6cf48b06bf 100644 (file)
@@ -303,7 +303,8 @@ calc_rank_or(float *w, tsvector * t, QUERYTYPE * q)
 */
                 res = res + ( wjm + resj - wjm/((jm+1)*(jm+1)))/1.64493406685; 
        }
-       res = res /size;
+       if ( size > 0 )
+               res = res /size;
        pfree(item);
        return res;
 }