|
|
|
|
@ -7,7 +7,7 @@ |
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
* IDENTIFICATION |
|
|
|
|
* $PostgreSQL: pgsql/src/backend/utils/adt/tsrank.c,v 1.7 2007/09/13 06:54:35 teodor Exp $ |
|
|
|
|
* $PostgreSQL: pgsql/src/backend/utils/adt/tsrank.c,v 1.8 2007/09/20 18:10:57 teodor Exp $ |
|
|
|
|
* |
|
|
|
|
*------------------------------------------------------------------------- |
|
|
|
|
*/ |
|
|
|
|
@ -21,7 +21,7 @@ |
|
|
|
|
#include "miscadmin.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static float weights[] = {0.1, 0.2, 0.4, 1.0}; |
|
|
|
|
static float weights[] = {0.1f, 0.2f, 0.4f, 1.0f}; |
|
|
|
|
|
|
|
|
|
#define wpos(wep) ( w[ WEP_GETWEIGHT(wep) ] ) |
|
|
|
|
|
|
|
|
|
@ -43,7 +43,7 @@ static float4 |
|
|
|
|
word_distance(int4 w) |
|
|
|
|
{ |
|
|
|
|
if (w > 100) |
|
|
|
|
return 1e-30; |
|
|
|
|
return 1e-30f; |
|
|
|
|
|
|
|
|
|
return 1.0 / (1.005 + 0.05 * exp(((float4) w) / 1.5 - 2)); |
|
|
|
|
} |
|
|
|
|
@ -336,7 +336,7 @@ calc_rank(float *w, TSVector t, TSQuery q, int4 method) |
|
|
|
|
calc_rank_and(w, t, q) : calc_rank_or(w, t, q); |
|
|
|
|
|
|
|
|
|
if (res < 0) |
|
|
|
|
res = 1e-20; |
|
|
|
|
res = 1e-20f; |
|
|
|
|
|
|
|
|
|
if ((method & RANK_NORM_LOGLENGTH) && t->size > 0) |
|
|
|
|
res /= log((double) (cnt_length(t) + 1)) / log(2.0); |
|
|
|
|
|