Skip to content

Commit 1dd6bd1

Browse files
committed
Add sanity check of query
1 parent 90456d1 commit 1dd6bd1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

contrib/tsearch2/rank.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,8 @@ calc_rank_or(float *w, tsvector * t, QUERYTYPE * q)
303303
*/
304304
res = res + ( wjm + resj - wjm/((jm+1)*(jm+1)))/1.64493406685;
305305
}
306-
res = res /size;
306+
if ( size > 0 )
307+
res = res /size;
307308
pfree(item);
308309
return res;
309310
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy