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

Add support for fuzzy case-insensitive match in PropertyRef #1383

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

achantavy
Copy link
Contributor

Summary

Describe your changes.

We often need to connect 2 nodes based on a fuzzy match like in #1380 (comment). This PR adds a fuzzy_and_ignore_case option to the PropertyRef so that the final rendered query performs a CONTAINS in a case-insensitive way instead of an exact match.

Related issues or links

Include links to relevant issues or other pages.

#1380

Checklist

Provide proof that this works (this makes reviews move faster). Please perform one or more of the following:

  • Update/add unit or integration tests.
  • Include a screenshot showing what the graph looked like before and after your changes.
  • Include console log trace showing what happened before and after your changes.

class FakeEmp2ToGitHubUser(CartographyRelSchema):
target_node_label: str = 'GitHubUser'
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
{'username': PropertyRef('github_username', fuzzy_and_ignore_case=True)},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@SecPrez: this will allow us to connect 2 nodes in a "fuzzy" way, lemme know if this helps

WITH i, item
OPTIONAL MATCH (n0:GitHubUser)
WHERE
toLower(n0.username) CONTAINS toLower(item.github_username)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@SecPrez this is what the final rendered query will look like

@achantavy
Copy link
Contributor Author

@ramonpetgrave64 - you might be not available but just cc'ing you here anyway since i think you have the most context on this kind of data model change

@achantavy
Copy link
Contributor Author

@heryxpc lemme know what you think too

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.

1 participant