Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5be16e3

Browse files
author
Artur Zakirov
committed
Fix error with distance difference
1 parent 8b0295d commit 5be16e3

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

rum_ts_utils.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ typedef struct
4949
{
5050
QueryItem **item;
5151
int16 nitem;
52+
QueryItem *item_first;
5253
int32 keyn;
5354
uint8 wclass;
5455
int32 pos;
@@ -711,7 +712,6 @@ get_docrep_addinfo(bool *check, QueryRepresentation *qr, int *map_item_operand,
711712
Datum *addInfo, bool *addInfoIsNull, uint32 *doclen)
712713
{
713714
QueryItem *item = GETQUERY(qr->query);
714-
WordEntryPos post;
715715
int32 dimt,
716716
j,
717717
i;
@@ -724,7 +724,8 @@ get_docrep_addinfo(bool *check, QueryRepresentation *qr, int *map_item_operand,
724724

725725
for (i = 0; i < qr->query->size; i++)
726726
{
727-
int keyN;
727+
int keyN;
728+
WordEntryPos post = 0;
728729

729730
if (item[i].type != QI_VAL)
730731
continue;
@@ -756,12 +757,10 @@ get_docrep_addinfo(bool *check, QueryRepresentation *qr, int *map_item_operand,
756757

757758
for (j = 0; j < dimt; j++)
758759
{
759-
if (ptrt == (char *) POSNULL.pos)
760-
post = POSNULL.pos[0];
761-
else
762-
ptrt = decompress_pos(ptrt, &post);
760+
ptrt = decompress_pos(ptrt, &post);
763761

764762
doc[cur].item = NULL;
763+
doc[cur].item_first = item + i;
765764
doc[cur].keyn = keyN;
766765
doc[cur].pos = WEP_GETPOS(post);
767766
doc[cur].wclass = WEP_GETWEIGHT(post);
@@ -980,7 +979,10 @@ calc_score_docr(float4 *arrdata, DocRepresentation *doc, uint32 doclen,
980979
InvSum += arrdata[ptr->wclass];
981980
/* SK: Quick and dirty hash key. Hope collisions will be not too frequent. */
982981
new_cover_key = new_cover_key << 1;
983-
new_cover_key += (int)(uintptr_t)ptr->item;
982+
if (ptr->item != NULL)
983+
new_cover_key += (int)(uintptr_t)ptr->item;
984+
else
985+
new_cover_key += (int)(uintptr_t)ptr->item_first;
984986
ptr++;
985987
}
986988

0 commit comments

Comments
 (0)