Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
84151d06
Commit
84151d06
authored
Nov 22, 2006
by
Teodor Sigaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid infinity calculations in rank_cd
parent
ba2edcac
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
contrib/tsearch2/rank.c
contrib/tsearch2/rank.c
+11
-1
No files found.
contrib/tsearch2/rank.c
View file @
84151d06
...
...
@@ -667,6 +667,7 @@ calc_rank_cd(float4 *arrdata, tsvector * txt, QUERYTYPE * query, int method)
{
double
Cpos
=
0
.
0
;
double
InvSum
=
0
.
0
;
int
nNoise
;
DocRepresentation
*
ptr
=
ext
.
begin
;
while
(
ptr
<=
ext
.
end
)
...
...
@@ -676,7 +677,16 @@ calc_rank_cd(float4 *arrdata, tsvector * txt, QUERYTYPE * query, int method)
}
Cpos
=
((
double
)
(
ext
.
end
-
ext
.
begin
+
1
))
/
InvSum
;
Wdoc
+=
Cpos
/
((
double
)
((
1
+
(
ext
.
q
-
ext
.
p
)
-
(
ext
.
end
-
ext
.
begin
))));
/*
* if doc are big enough then ext.q may be equal to ext.p
* due to limit of posional information. In this case we
* approximate number of noise word as half cover's
* length
*/
nNoise
=
(
ext
.
q
-
ext
.
p
)
-
(
ext
.
end
-
ext
.
begin
);
if
(
nNoise
<
0
)
nNoise
=
(
ext
.
end
-
ext
.
begin
)
/
2
;
Wdoc
+=
Cpos
/
((
double
)
(
1
+
nNoise
));
CurExtPos
=
((
double
)
(
ext
.
q
+
ext
.
p
))
/
2
.
0
;
if
(
NExtent
>
0
&&
CurExtPos
>
PrevExtPos
/* prevent devision by
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment