Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support match_phrase_prefix function in SQL/PPL query engine #186

Closed
5 tasks
chloe-zh opened this issue Aug 20, 2021 · 1 comment
Closed
5 tasks

Support match_phrase_prefix function in SQL/PPL query engine #186

chloe-zh opened this issue Aug 20, 2021 · 1 comment

Comments

@chloe-zh
Copy link
Contributor

chloe-zh commented Aug 20, 2021

Related design is presented in issue #182

Todo list

  • Support the match_phrase_prefix functionality by pushing it down to the search engine
  • Enable match_phrase_prefix function in SQL and PPL syntax and parser, including all the available parameters
  • Add unit tests. (Unit tests are mandatory for all code changes.)
  • Add integration test cases for match_phrase_prefix
  • Update user manual

Function details

The match_phrase_prefix function maps to the match phrase prefix query used in search engine. This query returns documents that contains the words of a provided text, in the same order as provided. The last term of the provided text is treated as a prefix, matching any words that begin with that term.

Syntax:
match_phrase_prefix(field_expression, query_expression[, option=<option_value>]*)

Available options:

  • analyzer
  • max_expansions
  • slop
  • zero_terms_query

Sample queries:

# Search query
GET my_index/_search
{
  "query": {
    "match_phrase_prefix": {
      "message": {
        "query": "quick brown f"
      }
    }
  }
}

# SQL
SELECT * FROM my_index WHERE match_phrase_prefix(message, "quick brown f")

# PPL
source=my_index | where match_phrase_prefix(message, "quick brown f")
MaxKsyunz referenced this issue in Bit-Quill/opensearch-project-sql Jun 16, 2022
…refix-#186

# Conflicts:
#	core/src/main/java/org/opensearch/sql/expression/DSL.java
#	core/src/main/java/org/opensearch/sql/expression/function/OpenSearchFunctions.java
#	core/src/test/java/org/opensearch/sql/analysis/ExpressionAnalyzerTest.java
#	opensearch/src/main/java/org/opensearch/sql/opensearch/storage/script/filter/FilterQueryBuilder.java
#	opensearch/src/test/java/org/opensearch/sql/opensearch/storage/script/filter/FilterQueryBuilderTest.java
#	sql/src/main/antlr/OpenSearchSQLLexer.g4
#	sql/src/main/antlr/OpenSearchSQLParser.g4
MaxKsyunz referenced this issue in Bit-Quill/opensearch-project-sql Jun 24, 2022
…refix-#186

# Conflicts:
#	core/src/main/java/org/opensearch/sql/expression/DSL.java
#	docs/user/dql/functions.rst
#	docs/user/ppl/functions/relevance.rst
@MaxKsyunz MaxKsyunz mentioned this issue Jun 28, 2022
6 tasks
MaxKsyunz referenced this issue in Bit-Quill/opensearch-project-sql Jun 29, 2022
…prefix-#186

Signed-off-by: MaxKsyunz <[email protected]>

# Conflicts:
#	core/src/main/java/org/opensearch/sql/expression/function/BuiltinFunctionName.java
#	docs/user/dql/functions.rst
#	opensearch/src/main/java/org/opensearch/sql/opensearch/storage/script/filter/FilterQueryBuilder.java
#	ppl/src/main/antlr/OpenSearchPPLLexer.g4
#	ppl/src/main/antlr/OpenSearchPPLParser.g4
#	sql/src/main/antlr/OpenSearchSQLParser.g4
@acarbonetto
Copy link
Collaborator

fixed by #661 and Bit-Quill#79

@dai-chen dai-chen closed this as completed Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants