$SCORE
The $SCORE function returns the "score" used to determine rank
and relevancy of qualified text. Most textual applications are designed
to qualify a large selection of rows and then present them in order of
relevancy. A scoring algorithm ranks qualified text according to occurrence
frequency, proximity, and several other factors, depending on the qualification
criteria.
The $SCORE function must always be accompanied by the $CONTAINS
function. Scores are only calculated when a $CONTAINS function is present
in a WHERE clause predicate and therefore only available for retrieval
at these times.
The $SCORE function can be used in all SELECT statement clauses including
the select list, the WHERE clause and the ORDER BY clause.
When multiple $CONTAINS functions are present in the SELECT statement,
each $CONTAINS function MUST have a unique label, and each $SCORE function
MUST reference one of those labels.
Syntax
$SCORE[(options[, label])]
$SCORE
Required.
options
Optional. See Options (below) for a list of valid
options.
label
Optional. A label linking this $SCORE function to a specific $CONTAINS
function. Required when multiple $CONTAINS functions are present in the
SELECT statement. This label is case-insensitive and may be up to 32 characters
in length.
The $SCORE function returns a value of data type FLOAT length 4.
Options
There are currently no options available for use with the $SCORE function.
Example
> select $score, title from books where $contains(content,'white
rabbit') order by $score desc
$SCORE
--------------------------------
TITLE
-----------------------------------------------------------------------------
79.050003
Alice's Adventures in Wonderland
29.570000
The Adventures of Huckleberry Finn
18.160000
Webster's Revised Unabridged Dictionary (1913)
2.860000
The Taming of the Shrew
2.860000
The Adventures of Tom Sawyer
5 rows returned
>
This is the same statement but shows the context in which the qualified
text occurred.
> select $score, title, $context from books where $contains(content,'white
rabbit') order by $score desc
$SCORE
--------------------------------
TITLE
-----------------------------------------------------------------------------
$CONTEXT(BOOKS.CONTENT)
-----------------------------------------------------------------------------
79.050003
Alice's Adventures in Wonderland
--- daisies, when suddenly a White Rabbit with pink eyes ran --- It was
the
>> White Rabbit returning, splendidly dressed, with --- Bill It
was the
>> White Rabbit, trotting slowly back again, ---
29.570000
The Adventures of Huckleberry Finn
--- de on'y white genlman dat ever...the spunk of a rabbit. --- Is your
man
>> white or black?" I...the spunk of a rabbit. --- the spunk
of a rabbit.
>> I see I...up and says: "He's white." ---
18.160000
Webster's Revised Unabridged Dictionary (1913)
--- a yellow disk and white or pinkish...ashkoko, dassy, and rock rabbit.
>> --- ashkoko, dassy, and rock rabbit. See Cony, and...brocade.
Dambonite
>> (n.) A white, crystalline, sugary substance obtained ---
2.860000
The Taming of the Shrew
--- parsley to stuff a rabbit; and so may...gentlewoman? Such war of white
>> and red within her ---
2.860000
The Adventures of Tom Sawyer
--- a hunted and helpless rabbit look as she...her face--it was white
with
>> terror] --"did you ---
5 rows returned
>
Top
|