Skip to content

Add MatchPhrasePrefix As Alternate Syntax for Match_Phrase_Prefix Function #164

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

Conversation

GabeFernandez310
Copy link

Description

Adds matchphraseprefix as alternate syntax for match_phrase_prefix function which currently exists in opensearch

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]>
@codecov
Copy link

codecov bot commented Nov 14, 2022

Codecov Report

Merging #164 (7207920) into integ-add-legacy-syntax-for-match_phrase_prefix-function (03f30e3) will decrease coverage by 2.56%.
The diff coverage is 100.00%.

@@                                      Coverage Diff                                       @@
##             integ-add-legacy-syntax-for-match_phrase_prefix-function     #164      +/-   ##
==============================================================================================
- 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 Δ
...arch/storage/script/filter/FilterQueryBuilder.java 100.00% <ø> (ø)
...h/sql/expression/function/BuiltinFunctionName.java 100.00% <100.00%> (ø)
...h/sql/expression/function/OpenSearchFunctions.java 100.00% <100.00%> (ø)
workbench/public/components/SQLPage/SQLPage.tsx 100.00% <0.00%> (ø)
workbench/public/components/app.tsx 0.00% <0.00%> (ø)
workbench/public/application.tsx 0.00% <0.00%> (ø)
workbench/public/utils/PanelWrapper.tsx 100.00% <0.00%> (ø)
workbench/public/components/Main/main.tsx 53.00% <0.00%> (ø)
...ublic/components/QueryResults/QueryResultsBody.tsx 68.32% <0.00%> (ø)
...h/public/components/QueryLanguageSwitch/Switch.tsx 85.71% <0.00%> (ø)
... and 3 more

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

The matchphraseprefix 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.
It is an alternate syntax for the `match_phrase_prefix`_ function.
Available parameters include:

Choose a reason for hiding this comment

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

whitespace


The matchphraseprefix 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.
It is an alternate syntax for the `match_phrase_prefix`_ function.

Choose a reason for hiding this comment

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

Can you mention that this was added for backwards compatibility

@@ -427,6 +427,7 @@ systemFunctionName
singleFieldRelevanceFunctionName
: MATCH | MATCH_PHRASE | MATCHPHRASE
| MATCH_BOOL_PREFIX | MATCH_PHRASE_PREFIX
| MATCHPHRASEPREFIX

Choose a reason for hiding this comment

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

nit: put MATCH_PHRASE_PREFIX and MATCHPHRASEPREFIX on the same line

@forestmvey
Copy link

The query
SELECT * FROM stackexchange_beer WHERE matchphraseprefix(Title, 'beer');
in the legacy engine yields results:
org.opensearch.sql.legacy.exception.SqlParseException: unsupported method: matchphraseprefix

Don't think we need to include this as it isn't supported in the legacy engine.

Copy link

@forestmvey forestmvey left a comment

Choose a reason for hiding this comment

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

Don't think this is needed!

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.

@GabeFernandez310 GabeFernandez310 deleted the dev-add-legacy-syntax-for-match_phrase_prefix-function branch December 1, 2022 05:36
andy-k-improving pushed a commit that referenced this pull request Nov 16, 2024
* Import h3 library (#154)

Made following changes to make it compatible:
1. Rename package from elasticsearch to opensearch.geospatial
2. Update License headers
3. Update build file
4. Update settings to include sub projects

* Use Transport Request (#164)

Remove usage of deprecated BaseNodeRequest

* Update http client package to resolve build failure (#168) (#171)

* Introduce H3 min resolution constant (#165)

H3 version 1 has 16 resolutions, numbered 0 through 15.
Introduced a constant to represent min value, similar
to max value.

* Add geohex aggregation (#160)

This aggregation will use uber's h3 to group coordinates into H3 cell.
Created new aggregation type geohex_grid. The precision will be between
0 and 15. This aggreation has default precision as 5,
similar to geohash and geotile.

Signed-off-by: Vijayan Balasubramanian <[email protected]>

* Add integration test (#176)

Included integration test for geohex_grid.

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.

4 participants