This is a document for PGroonga 1.X. See PGroonga 2.x document when you're using recent PGroonga.
pgroonga.score
functionpgroonga.score
function returns precision as a number. If a record is more precision against searched query, the record has more higher number.
You can use pgroonga.score
function to get precision as a number. If a record is more precision against searched query, the record has more higher number.
double precision pgroonga.score(record)
record
is a table name.
Assume that you have the following schema:
CREATE TABLE score_memos (
id integer PRIMARY KEY,
content text
);
CREATE INDEX pgroonga_score_memos_content_index
ON score_memos
USING pgroonga (id, content);
record
must be score_memos
:
SELECT *, pgroonga.score(tableoid, ctid)
FROM score_memos
WHERE content %% 'PGroonga';
pgroonga_score
function return precision as double precision
type value.
You need to add primary key column into pgroonga
index to use pgroonga.score
function. If you don't add primary key column into pgroonga
index, pgroonga.score
function always returns 0.0
.
pgroonga.score
function always returns 0.0
when full text search isn't performed by index. In other words, pgroonga.score
function always returns 0.0
when full text search is performed by sequential scan.
If pgroonga.score
function returns 0.0
unexpectedly, confirm the followings:
Score is "how many keywords are included" (TF, Term Frequency) for now. Groonga supports customizing how to score. But PGroonga doesn't support yet it for now.
See examples in tutorial.