Skip to content

[Bug]: Search OR returns everything when no tag exists #1287

@FloriPro

Description

@FloriPro

Checklist

  • I am using an up-to-date version.
  • I have read the documentation.
  • I have searched existing issues.

TagStudio Version

Alpha 9.5.6

Operating System & Version

Windows 11

Description

When searching with an OR operator, if none of the tags used exist in the library, the or statement gets ignored.

Expected Behavior

Because no entry has the requested tags (because they don't exist), i would asume that nothing get's returned.

Steps to Reproduce

  1. Open a library
  2. Enter an OR search query, where every tag is not in the library (example: "tag:a or tag:b", where tag a and b do not exist)
  3. Everything get's displayed

Logs

2026-01-06 17:39:36 [info     ] SQL Expression Builder finished (0 seconds)
2026-01-06 17:39:36 [info     ] searching library              filter=BrowsingState(page_index=0, sorting_mode=<SortingModeEnum.DATE_ADDED: 'file.date_added'>, ascending=False, random_seed=0, show_hidden_entries=False, query='tag:a or tag:b') query_full='SELECT DISTINCT entries.id \nFROM entries \nWHERE NOT (EXISTS (SELECT 1 \nFROM tags, tag_entries \nWHERE entries.id = tag_entries.entry_id AND tags.id = tag_entries.tag_id AND tags.is_hidden)) ORDER BY entries.id DESC'
2026-01-06 17:39:36 [info     ] SQL Execution finished (0.1 seconds)
2026-01-06 17:39:36 [info     ] items to render                count=2047

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugSomething isn't working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions