-
-
Notifications
You must be signed in to change notification settings - Fork 388
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
feat: Implement Query lang #606
Conversation
NOT operator also seems to not work ( |
TODO: port |
4d1f5f7
to
1f6b437
Compare
54c8c73
to
88b0200
Compare
NOT is now implemented |
|
||
def visit_not(self, node: Not) -> ColumnExpressionArgument: | ||
return ~Entry.id.in_( | ||
# TODO TSQLANG there is technically code duplication from Library.search_library here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really sure on whether / how I should deal with this duplication, opinions would be appreciated
I have now written every test I could think of and then some. (Going through the code you might see |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fantastic! Works great on my end, and I don't even have much in terms of review feedback left at this point.
Thank you so much for your amazing work on this!!
Co-authored-by: Travis Abendshien <[email protected]>
it's strange. i didn’t encounter any errors on my system (windows and ubuntu 22.04) using the same from src.core.library.alchemy import Library
from src.core.library.alchemy.library import Entry, LibraryStatus
from .enums import ItemType
from .library import Library
from .models import Entry, Tag
__all__ = ["Entry", "Library", "Tag", "ItemType"] isn’t that odd? but it’s just a weird assumption for a weird issue. nvm.
the TagStudio/.github/workflows/ruff.yaml Lines 10 to 20 in 4265fde
TagStudio/.github/workflows/mypy.yaml Lines 26 to 29 in 4265fde
|
* add files * fix: term was parsing ANDList instead of ORList * make mypy happy * ruff format * add missing todo * add more constraint types * add parent property to AST * add BaseVisitor class * make mypy happy * add __init__.py * Revert "make mypy happy" This reverts commit 926d0dd. * refactoring and fixes * rudimentary search field integration * fix: check for None properly * fix: Entries without Tags are now searchable * make mypy happy * Revert "fix: Entries without Tags are now searchable" This reverts commit 19b40af. * fix: changed joins to outerjoins and added missing outerjoin * use query lang instead of tag_id FIlterState * add todos * fix: remove uncecessary line that broke search when searching for exact name * fix tag search * refactoring * fix: path now uses GLOB operator for proper GLOBs * refactoring: remove FilterState.id and implement Library.get_entry_full as replacement * fix: use default value notation instead of if None statement in __post_init__ * remove obsolete Search Mode UI and related code * ruff fixes * remove obsolete tests * fix: item_thumb didn't query entries correctly * fix: search_library now correctly returns the number of *unique* entries * make mypy happy * implement NOT * remove obsolete filename search * remove summary as it is not applicable anymore * finish refactoring of FilterState * implement special:untagged * fix: make mypy happy * Revert changes to search_tags in favor of changes from TagStudioDev#604 * fix: also port test changes * fix: remove unneccessary import * fix: remove unused dataclass * fix: AND now works correctly with tags * simplify structure of parsed AST * add performance logging * perf: Improve performance of search by reducing number of required joins from 4 to 1 * perf: double NOT is now optimized out of the AST * fix: bug where pages would show less than the configured number of entries * Revert "add performance logging" This reverts commit c3c7d75. * fix: tag_id search was broken * somewhat adapt the existing autocompletion to this PR * perf: Use Relational Division Queries to improve Query Execution Time * fix: raise Exception so as to not fail silently * fix: Parser bug broke parentheses * little bit of clean up * remove unnecessary comment * add library for testing search * feat: add basic tests * fix: and queries containing just one tag were broken * chore: remove debug code * feat: more tests * refactor: more consistent name for variable Co-authored-by: Travis Abendshien <[email protected]> * fix: ruff check complaint over double import --------- Co-authored-by: Travis Abendshien <[email protected]>
Implements #600
Current supported Grammar:
Notes:
path:<glob>
searches entries using a UNIX-Style GLOBspecial:untagged
searches for entries that don't have any tagsLimitations / Future Work:
Todo:
21. That might drastically improve performance