Fix malformed query exception on neptune edge_fulltext_search #1032
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
In the logic for performing full-text search on edges, if a document is found in OpenSearch’s edge_name_and_fact index, the UUID of that document is used as a parameter to further query Neptune for the related triplet. The MalformedQueryException occurs at this stage due to a syntax error in the Neptune query. In the query source code shown below, the cause of the MalformedQueryException is that the filter_query contains its own WHERE clause, resulting in the overall query having two WHERE clauses, which is invalid syntax.
error log:
graphiti_core.driver.neptune_driver: Error executing query: {'message': 'An error occurred while executing the query.', 'details': "An error occurred (MalformedQueryException) when calling the ExecuteOpenCypherQuery operation: Invalid input 'H': expected 'i/I' (line 6, column 27 (offset: 231))"}Type of Change
Objective
For new features and performance improvements: Clearly describe the objective and rationale for this change.
Testing
Breaking Changes
If this is a breaking change, describe:
Checklist
make lintpasses)Related Issues
Closes #[issue number]