Costin Leau 61f49af497 SQL: Spec tests now use classpath discovery (#40388)
To avoid having to specify each spec by hand (which can miss specs to be
added), the test infrastructure now performs classpath discovery so that
each spec added, is automatically considered.

Relates #40358

(cherry picked from commit d0f60b4425c731509aa8ca765d55f563f866ef90)
2019-03-25 15:22:52 +02:00

46 lines
1.3 KiB
Plaintext

[role="xpack"]
[testenv="basic"]
[[sql-functions-search]]
=== Full-Text Search Functions
Search functions should be used when performing full-text search, namely
when the `MATCH` or `QUERY` predicates are being used.
Outside a, so-called, search context, these functions will return default values
such as `0` or `NULL`.
[[sql-functions-search-score]]
==== `SCORE`
.Synopsis:
[source, sql]
--------------------------------------------------
SCORE()
--------------------------------------------------
*Input*: _none_
*Output*: `double` numeric value
.Description:
Returns the {defguide}/relevance-intro.html[relevance] of a given input to the executed query.
The higher score, the more relevant the data.
NOTE: When doing multiple text queries in the `WHERE` clause then, their scores will be
combined using the same rules as {es}'s
<<query-dsl-bool-query,bool query>>.
Typically `SCORE` is used for ordering the results of a query based on their relevance:
["source","sql",subs="attributes,callouts,macros"]
----
include-tagged::{sql-specs}/docs/docs.csv-spec[orderByScore]
----
However, it is perfectly fine to return the score without sorting by it:
["source","sql",subs="attributes,callouts,macros"]
----
include-tagged::{sql-specs}/docs/docs.csv-spec[scoreWithMatch]
----