Skip to content

fix(search): apply a constraint prefix only to its own term - #1568

Merged
CyanVoxel merged 1 commit into
TagStudioDev:mainfrom
jayhemnani9910:fix/search-constraint-type-per-term
Nov 13, 2026
Merged

CyanVoxel merged 1 commit into
TagStudioDev:mainfrom
jayhemnani9910:fix/search-constraint-type-per-term

Conversation

@jayhemnani9910

Copy link
Copy Markdown
Contributor

Summary

A path:, filetype: or mediatype: prefix carried over to every later term without a prefix, because the parser kept the last constraint type on the instance and never reset it. So the result depended on word order:

filetype:jpeg vacation          -> nothing (looks for file type "vacation")
mediatype:image not vacation    -> also returns the photos tagged vacation
path:*summer* not vacation      -> also returns the photo tagged vacation

vacation filetype:jpeg worked. A term without a prefix is now always a tag search, as the search docs describe, and __constraint keeps the type in a local variable.

Tasks Completed

  • Platforms Tested:
    • Linux x86
  • Tested For:
    • Basic functionality

Added ("filetype:png orange", 5) next to ("orange filetype:png", 5) in test_search.py; it fails without the change. Full test suite 316 passed (315 on main). The three queries above, run through Library.search_library on a small library, return the expected files with the change.

@TrigamDev

Copy link
Copy Markdown
Collaborator

Tested and can confirm it fixes the issue.

@CyanVoxel CyanVoxel added TagStudio: Search The TagStudio search engine Type: Fix A fix for a bug, typo, or other issue labels Nov 13, 2026
@CyanVoxel CyanVoxel added this to the Alpha v9.7.0 milestone Nov 13, 2026

@CyanVoxel CyanVoxel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Awesome, thank you for the fix!

@CyanVoxel
CyanVoxel merged commit 7b39cce into TagStudioDev:main Nov 13, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

TagStudio: Search The TagStudio search engine Type: Fix A fix for a bug, typo, or other issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants