The way I see it, the ‘who’ search should only apply to the sub-set of assets that have exactly 1 ‘who’ tag. It certainly would help if the asset table had various root tag counts (i.e. a WhoTagCount column, etc). But perhaps a subselect could achieve the same without actually storing the count as a discrete column?
EDIT: I was inspired to poke around in the sqlite db…
so I created a view as such:
CREATE VIEW WhoTagCount as select at.assetId, count(*) as WhoTagCount from assetTag at, tag t where at.tagId = t.id and _path like 'Who%' group by at.assetId
Then I joined that view in a search query as such:
select * from assetTag at, Tag t, WhoTagCount c where t.id = at.tagId and t._path like '%Genki%' and at.assetId = c.assetId and WhoTagCount = 1
This returned 3 assets out of 17 that have ‘Genki’ in them:
Converting the view to an actual table (or storing WhoTagCount in the asset table) would improve performance, however, it returns instant results on my smallish database of 80,000 assets as it is.