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

feat: Implement Query lang #606

Open
wants to merge 43 commits into
base: main
Choose a base branch
from

Conversation

Computerdores
Copy link
Collaborator

@Computerdores Computerdores commented Nov 27, 2024

Implements #600

Current supported Grammar:

ORList         = ANDList ( "OR", ANDList)* ;
ANDList        = Term ( ["AND"] Term )* ;
Term           = Constraint | "(", ORList, ")" | "NOT", Term ;

Constraint     = [ConstraintType, ":"], Literal, "[", PropertyList, "]" ;

ConstraintType = "tag" | "tag_id" | "mediatype" | "filetype" | "path" | "special" ; (* not case sensitive *)
PropertyList   = Property, (",", Property)* ;
Property       = ULITERAL, "=", Literal ;
Literal        = ULITERAL | QLITERAL ;

Notes:

  • path:<glob> searches entries using a UNIX-Style GLOB
  • special:untagged searches for entries that don't have any tags

@python357-1
Copy link
Collaborator

python357-1 commented Nov 27, 2024

NOT operator also seems to not work (NOT tag_id:1000 returns no results) in a library with entries that dont have tag id 1000

@Computerdores
Copy link
Collaborator Author

TODO: port untagged and empty or equivalents

@CyanVoxel CyanVoxel added Type: Enhancement New feature or request Type: QoL A quality of life (QoL) enhancement or suggestion Priority: High An important issue requiring attention TagStudio: Search The TagStudio search engine labels Nov 28, 2024
@CyanVoxel CyanVoxel added this to the Alpha v9.5 (Post-SQL) milestone Nov 28, 2024
@CyanVoxel CyanVoxel linked an issue Nov 28, 2024 that may be closed by this pull request
3 tasks
@Computerdores
Copy link
Collaborator Author

NOT operator also seems to not work (NOT tag_id:1000 returns no results) in a library with entries that dont have tag id 1000

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
Copy link
Collaborator Author

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

@Computerdores Computerdores marked this pull request as ready for review November 28, 2024 22:28
@Computerdores Computerdores changed the title [Draft] Implement Query lang feat: Implement Query lang Nov 28, 2024
@CyanVoxel CyanVoxel added the Status: Review Needed A review of this is needed label Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: High An important issue requiring attention Status: Review Needed A review of this is needed TagStudio: Search The TagStudio search engine Type: Enhancement New feature or request Type: QoL A quality of life (QoL) enhancement or suggestion
Projects
Status: 🏓 Ready for Review
Development

Successfully merging this pull request may close these issues.

[Feature Request]: FINAL search engine features for 9.5
3 participants