Skip to content

Fix for issue #3740 #503

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

Merged
merged 3 commits into from
Mar 16, 2020
Merged

Fix for issue #3740 #503

merged 3 commits into from
Mar 16, 2020

Conversation

tcchhabra
Copy link

No description provided.

@tcchhabra tcchhabra changed the title [WIP] fix for issue #3740 Fix for issue #3740 Mar 11, 2020
Copy link
Contributor

@maxceem maxceem left a comment

Choose a reason for hiding this comment

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

@tcchhabra the proposed solution has several issues.

I've created 2 projects, one with name "XYZ" and another one with name "ABC/D". Note, that we can search using a normal string abc/d or string in quotes "abc/d".

How it works before your changes

  • xyz:

    image

  • "xyz":

    image

  • abc/d:

    image

  • "abc/d":

    image

How it works after your changes

  • xyz:

    image

  • "xyz":

    image

  • abc/d:

    image

  • "abc/d":

    image

Sum up

  1. Now the case when we are searching using quotes is broken. To not broke this case, I think we only have to apply the escape method in case of wildcards search, here https://github.com/topcoder-platform/tc-project-service/blob/dev/src/routes/projects/list.js#L387 or something like this. I guess we shouldn't apply it in all the cases.

  2. We already have a method to encode query to ES, can we reuse it instead of creating a new method?

    image

  3. To validate that fix works properly, please create 2 unit tests:

    • should find a project by keyword with a special symbol in the name - find project abc/d using keyword=abc/d
    • should find a project by quoted keyword with a special symbol in the name - find project abc/d using keyword="abc/d"

@tcchhabra
Copy link
Author

checking

@tcchhabra
Copy link
Author

@maxceem I cannot use the other function, I have spent a good chunk of time try to reuse it but in vain so sticking with my function for handling this, which takes care of both the scenarios. Both test cases added.

Copy link
Contributor

@maxceem maxceem left a comment

Choose a reason for hiding this comment

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

Works good.

PS existent method escapeEsKeyword can be fixed by removing extra \\.

@maxceem maxceem merged commit 6c0f788 into topcoder-platform:cf21 Mar 16, 2020
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.

2 participants