Skip to content

Commit 19b40af

Browse files
committed
fix: Entries without Tags are now searchable
1 parent 6205f59 commit 19b40af

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

tagstudio/src/core/library/alchemy/library.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,8 +420,8 @@ def search_library(
420420

421421
if search.ast:
422422
statement = (
423-
statement.join(Entry.tag_box_fields)
424-
.join(TagBoxField.tags)
423+
statement.outerjoin(Entry.tag_box_fields)
424+
.outerjoin(TagBoxField.tags)
425425
.where(SQLBoolExpressionBuilder().visit(search.ast))
426426
)
427427
elif search.tag:

tagstudio/src/core/library/alchemy/visitors.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,16 @@ def visit_constraint(self, node: Constraint) -> ColumnExpressionArgument:
2929
elif node.type == ConstraintType.TagID:
3030
return Tag.id == int(node.value)
3131
elif node.type == ConstraintType.Path:
32-
return Entry.path.ilike(node.value.replace("*", "%")) # TODO TSQLANG this is broken
32+
return Entry.path.ilike(node.value.replace("*", "%"))
3333
elif node.type == ConstraintType.MediaType:
3434
extensions: set[str] = set[str]()
3535
for media_cat in MediaCategories.ALL_CATEGORIES:
3636
if node.value == media_cat.name:
3737
extensions = extensions | media_cat.extensions
3838
break
39-
return Entry.suffix.in_(
40-
map(lambda x: x.replace(".", ""), extensions)
41-
) # TODO audio doesn't work on mp3 files (might be my library)
39+
return Entry.suffix.in_(map(lambda x: x.replace(".", ""), extensions))
4240
elif node.type == ConstraintType.FileType:
43-
return Entry.suffix.ilike(
44-
node.value
45-
) # TODO TSQLANG this is broken for mp3, but works for png (might be my library)
41+
return Entry.suffix.ilike(node.value)
4642

4743
raise NotImplementedError("This type of constraint is not implemented yet")
4844

0 commit comments

Comments
 (0)