Skip to content

Conversation

@GabeFernandez310
Copy link

@GabeFernandez310 GabeFernandez310 commented Nov 14, 2022

Description

Adds match_query and matchquery as alternate syntax for match function which currently exists in opensearch

Queries can be performed using the following syntax :

matchquery(field, 'query')
match_query(field, 'query')

Example:

SELECT field FROM index WHERE matchquery(field, 'query');
SELECT field FROM index WHERE match_query(field, 'query');

These queries should return the same result as match(field, 'query')

Issues Resolved

AOS-765

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented.
    • New functionality has javadoc added
    • New functionality has user manual doc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: GabeFernandez310 <[email protected]>
Signed-off-by: GabeFernandez310 <[email protected]>
Signed-off-by: GabeFernandez310 <[email protected]>
Signed-off-by: GabeFernandez310 <[email protected]>
@codecov
Copy link

codecov bot commented Nov 14, 2022

Codecov Report

Merging #163 (77fcacd) into integ-add-legacy-syntax-for-match-function (03f30e3) will decrease coverage by 2.56%.
The diff coverage is 100.00%.

@@                               Coverage Diff                                @@
##             integ-add-legacy-syntax-for-match-function     #163      +/-   ##
================================================================================
- Coverage                                         98.27%   95.71%   -2.57%     
  Complexity                                         3351     3351              
================================================================================
  Files                                               327      337      +10     
  Lines                                              8457     9117     +660     
  Branches                                            553      672     +119     
================================================================================
+ Hits                                               8311     8726     +415     
- Misses                                              142      334     +192     
- Partials                                              4       57      +53     
Flag Coverage Δ
query-workbench 62.76% <ø> (?)
sql-engine 98.27% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...h/sql/expression/function/OpenSearchFunctions.java 100.00% <100.00%> (ø)
workbench/public/components/Main/main.tsx 53.00% <0.00%> (ø)
workbench/public/components/Header/Header.tsx 100.00% <0.00%> (ø)
...ch/public/components/QueryResults/QueryResults.tsx 61.60% <0.00%> (ø)
workbench/public/components/PPLPage/PPLPage.tsx 56.52% <0.00%> (ø)
workbench/public/utils/PanelWrapper.tsx 100.00% <0.00%> (ø)
workbench/public/components/app.tsx 0.00% <0.00%> (ø)
...h/public/components/QueryLanguageSwitch/Switch.tsx 85.71% <0.00%> (ø)
workbench/public/components/SQLPage/SQLPage.tsx 100.00% <0.00%> (ø)
...ublic/components/QueryResults/QueryResultsBody.tsx 68.32% <0.00%> (ø)
... and 1 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@acarbonetto
Copy link

@GabeFernandez310 can you add an example for new syntax please? This will help the verifier.


``match(field_expression, query_expression[, option=<option_value>]*)``

The match function maps to the match query used in search engine, to return the documents that match a provided text, number, date or boolean value with a given field. This is alternate syntax for the `match`_ function. Available parameters include:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here as above for matchquery

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just add a sentence like:

For backward compatibility, matchphrase is also supported and mapped to match_phrase query as well.

but using matchquery and match_query

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in cbccd33

Copy link

@MaxKsyunz MaxKsyunz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make sure SQL Java CI workflow passes.
Looks to be failing on checkstyle.

Copy link

@Yury-Fridlyand Yury-Fridlyand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add an IT which runs match_query, match and matchquery and compares results?
Something like:

var result1 = executeQuery(...);
var result2 = executeQuery(...);
assertTrue(result1.similar(result2));

@GabeFernandez310 GabeFernandez310 merged commit 33d7ee8 into integ-add-legacy-syntax-for-match-function Nov 18, 2022
@GabeFernandez310 GabeFernandez310 deleted the dev-add-legacy-syntax-for-match-function-alternate branch December 1, 2022 05:36
andy-k-improving pushed a commit that referenced this pull request Nov 16, 2024
Remove usage of deprecated BaseNodeRequest

Signed-off-by: Vijayan Balasubramanian <[email protected]>
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

Successfully merging this pull request may close these issues.

7 participants