Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit028bc43

Browse files
author
Artur Zakirov
committed
Improve speed
1 parent6ea179b commit028bc43

File tree

1 file changed

+5
-25
lines changed

1 file changed

+5
-25
lines changed

‎rum_ts_utils.c

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ typedef struct
6868
DocRepresentation*end;
6969
}Extention;
7070

71-
staticfloatweights[]= {0.1f,0.2f,0.4f,1.0f};
71+
staticfloatweights[]= {1.0/0.1f,1.0/0.2f,1.0/0.4f,1.0/1.0f};
7272

7373
/* A dummy WordEntryPos array to use when haspos is false */
7474
staticWordEntryPosVectorPOSNULL= {
@@ -702,11 +702,9 @@ get_docrep_addinfo(bool *check, QueryRepresentation *qr, int *map_item_operand,
702702
intlen=qr->query->size*4,
703703
cur=0;
704704
DocRepresentation*doc;
705-
char*operand;
706705
char*ptrt;
707706

708707
doc= (DocRepresentation*)palloc(sizeof(DocRepresentation)*len);
709-
operand=GETOPERAND(qr->query);
710708

711709
for (i=0;i<qr->query->size;i++)
712710
{
@@ -726,10 +724,7 @@ get_docrep_addinfo(bool *check, QueryRepresentation *qr, int *map_item_operand,
726724
ptrt= (char*)VARDATA_ANY(addInfo[keyN]);
727725
}
728726
else
729-
{
730-
dimt=POSNULL.npos;
731-
ptrt= (char*)POSNULL.pos;
732-
}
727+
continue;
733728

734729
while (cur+dimt >=len)
735730
{
@@ -754,20 +749,16 @@ get_docrep_addinfo(bool *check, QueryRepresentation *qr, int *map_item_operand,
754749

755750
for (k=0;k<qr->query->size;k++)
756751
{
757-
QueryOperand*kptr=&item[k].qoperand;
758-
QueryOperand*iptr=&item[i].qoperand;
759-
760752
if (k==i||
761-
(item[k].type==QI_VAL&&
762-
compareQueryOperand(&kptr,&iptr,operand)==0))
753+
(item[k].type==QI_VAL&&map_item_operand[i]==
754+
map_item_operand[k]))
763755
{
764756
/*
765757
* if k == i, we've already checked above that
766758
* it's type == Q_VAL
767759
*/
768760
doc[cur].item[doc[cur].nitem]=item+k;
769761
doc[cur].nitem++;
770-
QR_SET_OPERAND_EXISTS(qr,item+k);
771762
}
772763
}
773764
}
@@ -963,7 +954,6 @@ calc_score_docr(float4 *arrdata, DocRepresentation *doc, uint32 doclen,
963954
int32i;
964955
Extentionext;
965956
doubleWdoc=0.0;
966-
doubleinvws[lengthof(weights)];
967957
doubleSumDist=0.0,
968958
PrevExtPos=0.0,
969959
CurExtPos=0.0;
@@ -975,16 +965,6 @@ calc_score_docr(float4 *arrdata, DocRepresentation *doc, uint32 doclen,
975965
double*cover_ranks= (double*)palloc(0);
976966
intncovers=0;
977967

978-
for (i=0;i<lengthof(weights);i++)
979-
{
980-
invws[i]= ((double) ((arrdata[i] >=0) ?arrdata[i] :weights[i]));
981-
if (invws[i]>1.0)
982-
ereport(ERROR,
983-
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
984-
errmsg("weight out of range")));
985-
invws[i]=1.0 /invws[i];
986-
}
987-
988968
MemSet(&ext,0,sizeof(Extention));
989969
while (Cover(doc,doclen,qr,&ext))
990970
{
@@ -1000,7 +980,7 @@ calc_score_docr(float4 *arrdata, DocRepresentation *doc, uint32 doclen,
1000980

1001981
while (ptr <=ext.end)
1002982
{
1003-
InvSum+=invws[ptr->wclass];
983+
InvSum+=arrdata[ptr->wclass];
1004984
/* SK: Quick and dirty hash key. Hope collisions will be not too frequent. */
1005985
new_cover_key=new_cover_key <<1;
1006986
new_cover_key+= (int)(uintptr_t)ptr->item;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp