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 filter logic bugs #1753

Merged
merged 3 commits into from
Jan 3, 2025
Merged

Fix filter logic bugs #1753

merged 3 commits into from
Jan 3, 2025

Conversation

NolanTrem
Copy link
Collaborator

@NolanTrem NolanTrem commented Jan 3, 2025

Allows for better filtering, fixes a number of bugs around passing integers.

Fixes #1699


Important

Enhances filter logic and error handling for integer values and undefined columns, with new test cases and refactoring in filter-related modules.

  • Behavior:
    • Enhanced filter logic to handle integer values correctly in filters.py and graphs.py.
    • Added new test cases in DocumentsIntegrationSuperUser.test.ts to verify filter operations like $lte, $gte, $eq, and range filters.
  • Error Handling:
    • Improved error handling for undefined columns in graph_search() in graphs.py.
    • Added error handling for unsupported operators in filters.py.
  • Misc:
    • Updated docstrings and comments for clarity in filters.py and graphs.py.
    • Minor refactoring in search.py to streamline filter selection logic.

This description was created by Ellipsis for 0002c0c. It will automatically update as commits are pushed.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Reviewed everything up to 0002c0c in 2 minutes and 12 seconds

More details
  • Looked at 628 lines of code in 4 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. py/core/database/filters.py:376
  • Draft comment:
    The _build_metadata_condition method should handle cases where val is a list or dict for $eq and $ne operators, as these are not currently handled.
  • Reason this comment was not posted:
    Comment was on unchanged code.
2. py/core/database/filters.py:170
  • Draft comment:
    This function is identical to the existing psql_quote_literal. Consider using that instead to avoid duplication.

  • function psql_quote_literal (chunks.py)

  • Reason this comment was not posted:
    Comment was on unchanged code.

Workflow ID: wflow_LQP9JtPTUtOYc7Cp


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

},
},
}),
);
Copy link
Contributor

Choose a reason for hiding this comment

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

The test for filtering on a non-existent column is incomplete. It should check for an empty result set.

detail=f"An error occurred while searching: {e}",
) from e
except Exception as e:
raise HTTPException(
Copy link
Contributor

Choose a reason for hiding this comment

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

Catching a generic Exception and raising an HTTPException with a misleading message about updating an entity. This should be corrected to reflect the actual operation being performed.

@NolanTrem NolanTrem merged commit 9af89c4 into main Jan 3, 2025
14 of 15 checks passed
@NolanTrem NolanTrem deleted the Nolan/ImproveFilterErrors branch January 3, 2025 23:27
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.

Passing int for a searach filter causes 500
1 participant