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

fix character escaping for elasticsearch to work correctly #16025

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Alexandr-Nedomets
Copy link
Contributor

Describe your changes:

Fix character escaping for elasticsearch to work correctly
in more detail in ISSUE-16001
Fixes ISSUE-16001

Type of change:

  • [x ] Bug fix
  • Improvement
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation

Copy link

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

harshach
harshach previously approved these changes Apr 25, 2024
@harshach harshach added the safe to test Add this label to run secure Github workflows on PRs label Apr 25, 2024
Copy link

The Python checkstyle failed.

Please run make py_format and py_format_check in the root of your repository and commit the changes to this PR.
You can also use pre-commit to automate the Python code formatting.

You can install the pre-commit hooks with make install_test precommit_install.

Copy link

github-actions bot commented Apr 25, 2024

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 64%
64.76% (33910/52362) 42.05% (13422/31917) 43.4% (4171/9611)

Copy link

cypress bot commented Apr 25, 2024

13 failed tests on run #33990 ↗︎

13 930 1 34 Flakiness 0

Details:

Merge branch 'main' into ISSUE-16001
Project: openmetadata Commit: bfb0ae2ae1
Status: Failed Duration: 43:47 💡
Started: Apr 26, 2024 5:41 AM Ended: Apr 26, 2024 7:25 AM
Failed  Service/ServiceIngestion.spec.ts • 1 failed test • cypress-ci-mysql-pr-8843531936-1

View Output Video

Test Artifacts
Airflow Ingestion > Create & Ingest Airflow service Screenshots Video
Failed  Pages/Glossary.spec.ts • 2 failed tests • cypress-ci-mysql-pr-8843531936-1

View Output Video

Test Artifacts
Glossary page should work properly > Change glossary term hierarchy using menu options Screenshots Video
Glossary page should work properly > Remove asset from glossary term using asset modal Screenshots Video
Failed  Pages/DataQualityAndProfiler.spec.ts • 1 failed test • cypress-ci-mysql-pr-8843531936-1

View Output Video

Test Artifacts
Data Quality and Profiler should work properly > Add and ingest mysql data Screenshots Video
Failed  Features/IncidentManager.spec.ts • 1 failed test • cypress-ci-mysql-pr-8843531936-1

View Output Video

Test Artifacts
Incident Manager > Basic Scenario > Acknowledge table test case's failure Screenshots Video
Failed  Features/QueryEntity.spec.ts • 2 failed tests • cypress-ci-mysql-pr-8843531936-1

View Output Video

Test Artifacts
Query Entity > Update owner, description and tag Screenshots Video
Query Entity > Verify query filter Screenshots Video

The first 5 failed specs are shown, see all 9 specs in Cypress Cloud.

Review all test suite changes for PR #16025 ↗︎

@harshach
Copy link
Collaborator

@karanh37 can you review and merge

@@ -188,7 +188,9 @@ export const customServiceComparator = (a: string, b: string): number => {
export const replacePlus = (fqn: string) => fqn.replaceAll('+', ' ');

export const ES_RESERVED_CHARACTERS: Record<string, string> = {
'+': '\\+',
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi this is breaking at other places.
The idea behind this method is just to escape special characters.
We should not be encoding characters here.

Copy link
Contributor

@karanh37 karanh37 Apr 26, 2024

Choose a reason for hiding this comment

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

Refer Glossary Assets page.
Glossary terms with special names are not able to fetch assets because we are encoding here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi!
The error may occur because when querying the api /api/v1/search/query, the searchValue must be converted using the escapeESReservedCharacters method.
If you are wrong, describe the problem in more detail

Comment on lines 191 to 192
'&': '%26',
'#': '%23',
Copy link
Collaborator

Choose a reason for hiding this comment

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

@Alexandr-Nedomets can we escap the required chars here instead replacing it with encoding?
I have validated that we need to escape this chars instead encoding it. I will merge your PR once you push the changes.

Suggested change
'&': '%26',
'#': '%23',
'&': '\\&',
'#': '\\#',
'+': '\\+',

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, @chirag-madlani
If you fix it like this, the search will not work correctly.
This fix will not fix the problems @karanh37 wrote about.

auto-merge was automatically disabled May 2, 2024 13:13

Head branch was pushed to by a user without write access

Copy link

sonarcloud bot commented May 2, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
safe to test Add this label to run secure Github workflows on PRs UI UI specific issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants