diff --git a/docs/user/dql/functions.rst b/docs/user/dql/functions.rst index 72f5dc4e51..f0c36ebeae 100644 --- a/docs/user/dql/functions.rst +++ b/docs/user/dql/functions.rst @@ -2233,6 +2233,47 @@ Another example to show how to set custom values for the optional parameters:: +----------------------+--------------------------+ +MATCH_PHRASE_PREFIX +------------ + +Description +>>>>>>>>>>> + +``match_phrase_prefix(field_expression, query_expression[, option=]*)`` + +The match_phrase_prefix function maps to the match_phrase_prefix query used in search engine, +to return the documents that match a provided text with a given field. Available parameters include: + +- analyzer +- slop +- zero_terms_query +- max_expansions +- boost + + +Example with only ``field`` and ``query`` expressions, and all other parameters are set default values:: + + os> SELECT author, title FROM books WHERE match_phrase_prefix(author, 'Alexander Mil'); + fetched rows / total rows = 2/2 + +----------------------+--------------------------+ + | author | title | + |----------------------+--------------------------| + | Alan Alexander Milne | The House at Pooh Corner | + | Alan Alexander Milne | Winnie-the-Pooh | + +----------------------+--------------------------+ + +Another example to show how to set custom values for the optional parameters:: + + os> SELECT author, title FROM books WHERE match_phrase_prefix(author, 'Alan Mil', slop = 2); + fetched rows / total rows = 2/2 + +----------------------+--------------------------+ + | author | title | + |----------------------+--------------------------| + | Alan Alexander Milne | The House at Pooh Corner | + | Alan Alexander Milne | Winnie-the-Pooh | + +----------------------+--------------------------+ + + SIMPLE_QUERY_STRING ------------------- diff --git a/docs/user/ppl/functions/relevance.rst b/docs/user/ppl/functions/relevance.rst index af3c0af6c2..2a78cb3083 100644 --- a/docs/user/ppl/functions/relevance.rst +++ b/docs/user/ppl/functions/relevance.rst @@ -98,6 +98,51 @@ Another example to show how to set custom values for the optional parameters:: +----------------------+--------------------------+ + +MATCH_PHRASE_PREFIX +------------ + +Description +>>>>>>>>>>> + +``match_phrase_prefix(field_expression, query_expression[, option=]*)`` + +The match_phrase function maps to the match_phrase query used in search engine, to return the documents that match a provided text with a given field. Available parameters include: + +- analyzer +- slop +- max_expansions +- boost +- zero_terms_query + +For backward compatibility, matchphrase is also supported and mapped to match_phrase query as well. + +Example with only ``field`` and ``query`` expressions, and all other parameters are set default values:: + + os> source=books | where match_phrase_prefix(author, 'Alexander Mil') | fields author, title + fetched rows / total rows = 2/2 + +----------------------+--------------------------+ + | author | title | + |----------------------+--------------------------| + | Alan Alexander Milne | The House at Pooh Corner | + | Alan Alexander Milne | Winnie-the-Pooh | + +----------------------+--------------------------+ + + + +Another example to show how to set custom values for the optional parameters:: + + os> source=books | where match_phrase_prefix(author, 'Alan Mil', slop = 2) | fields author, title + fetched rows / total rows = 2/2 + +----------------------+--------------------------+ + | author | title | + |----------------------+--------------------------| + | Alan Alexander Milne | The House at Pooh Corner | + | Alan Alexander Milne | Winnie-the-Pooh | + +----------------------+--------------------------+ + + + SIMPLE_QUERY_STRING -------------------