tag/categories search/filter

Ideas for improvements and requests for new features in XnView MP

Moderators: XnTriq, xnview

zarlan
Posts: 53
Joined: Thu Apr 14, 2022 10:33 am

tag/categories search/filter

Post by zarlan »

There should be a way to filter/search by multiple tags and, very importantly, exclude tag.
(when I say tags, I am referring to what XnViewMP calls categories, but the rest of the World calls tags. I will call them tags, in this comment, and indeed thread. But remember: I am talking about what XnViewMP calls categories)
I suppose the same could/should also apply to doing the same, for metadata in files and/or sidecars. (I don't use those and am only really concerned with the tags in the XnViewMP catalogue database, but it should still apply)

I have (before I registered on this forum) done some internet searches, and found forum posts on this forum, with such bizarre statements, as "a good idea, discussed ages ago but nobody came up with a good GUI to select multi/exclude Categories".
This is utterly absurd, as there are old tried and true methods for exactly that, that work perfectly well, as I'll go through below
…but also:
This thread (viewtopic.php?t=17924) suggests that it has had some such capabilities …which have presumably been removed?

…and XnView apparently allows/allowed you to choose multiple tags, but only with OR, and not AND (viewtopic.php?t=21338 To quote from the thread "When I click on few categories the application shows all images which have ANY of the selected categories."

Back to how it would be easy to do:
Boolean operators have always been fundamental to all programming languages, and have been widely used in programs, right from the start
It would be easy to simply have a filter/search-bar, where you write in the tags and use boolean operators. (with the same autocompletion suggestions for tags, that you get in the "Categories"-panel [in the bar I've circled in the attached image] …except without the option of creating new tags, of course)
It would work perfectly well.
Like so:
To including [tag1] and [tag2], but exclude [tag3]:
[tag1] AND [tag2] NOT [tag3]
To search/filter for images with [tag1] and/or [tag2]
[tag1] OR [tag2]
To search/filter for images with [tag1] or [tag2], but not both
[tag1] XOR [tag2]
…and I'd suggest the ability to use of parentheses, as well.
Such as if you want images with [tag1] as well as one of the additional tags of [tag2] or [tag3] (but not both). That is images that have [tag1] and [tag2], or [tag1] and [tag3] (but not both [tag2] and [tag3]):
[tag1] AND ([tag2] XOR [tag3])

Some may now suspect, that using parentheses would cause a problem, due to some tags having parentheses in their name …but that wouldn't be a problem.
After all, what one writes in the filter/search-bar, could not possibly be treated by the program, as a simple text-string, with the text as one has written it.
After all, one can have several different tags, with the same name!
Writing the name of a tag, and just having that as simple text, to represent it, would create a conflict with the different tags with that same name. The program would not be able to distinguish which one is meant.
The autocompletion suggestions for tags, as in the "Categories"-panel (again: in the bar I've circled in the attached image), is an obvious neccesity, to identity the exact tag one means. Hence the tags have to be identified and then input in the filter/search-bar, as a distinct entity. (so the program would have to treat it as a separate and distinct entity, from the boolean operators and parentheses)

That said, it would be good to be able to search for tags with the same name, or (using wildcards) tags that have something as part of their name.

Of course, rather than using AND, NOT, OR, and XOR, you could choose to make it more intuitive and quick, and instead use '+' before tags to include, and '-' in front or those to exclude.
Use of parentheses would be exactly the same, of course (and their use is familiar to anyone with a bit of elementary school maths)
…but I'm not sure what characters would work best as replacements for OR and XOR, though. (maybe best to just keep those as OR and XOR?)
Like so:
To including [tag1] and [tag2], but exclude [tag3]:
+[tag1] +[tag2] -[tag3]
To search/filter for images with [tag1] and/or [tag2]
[tag1] OR [tag2]
To search/filter for images with [tag1] or [tag2], but not both
[tag1] XOR [tag2]
If you want images with [tag1] as well as one of the additional tags of [tag2] or [tag3] (but not both):
+[tag1] +([tag2] XOR [tag3])

Another thing that should added to the search/filter-bar, would be setting its scope:
All images in the catalogue, or a set folder …or multiple folders. (with options for including sub-folders, and when including subfolder, also having the option to exclude specific sub-folders)

Also, in addition to the search/filter-bar, having a panel that looks more or less like the "Categories"-panel, that can be used to choose tags for the search/filter-bar, would be a nice option.
Where the "Categories"-panel lets you press boxes, to set the tags of the selected image(s), this panel would have you press boxes to include tags in the search bar …and press the box again, to sets the tag to be excluded instead. (a third press, removing it from the search/filter-bar)
Naturally, any OR, XOR, and/or parentheses would have to be adjusted in the search/filter-bar, rather than in the panel.
Adding that panel, should be very easy, as it would, in large part, be a copy of the existing "Categories"-panel. (they would just need something to set it apart, visually, to avoid confusing them for each other)

As for where to place the search/filter-bar…
Putting in a down arrow (as on the layout menu on the toolbar, or to the right of the circled area in the attached image) on the "quick search"-bar, to allow one to switch between quick search and tag search/filtering. (or quick search, what XnView calls categories, embedded/sidecar tags, and categories+embedded/sidecar-tags)
You do not have the required permissions to view the files attached to this post.
User avatar
michel038
Posts: 846
Joined: Tue Sep 27, 2016 8:18 am
Location: France

Re: tag/categories search/filter

Post by michel038 »

1) "Categories filter" is not a perfect tool for database queries.
But it provides some quick and easy-to-use features
Another thing that should added to the search/filter-bar, would be setting its scope:
All images in the catalogue, or a set folder …or multiple folders. (with options for including sub-folders, and when including subfolder, also having the option to exclude specific sub-folders)
- At the top of categories filter pane, click on "Match" ...
Here you can choose whole database, or current folder, or current folder recursive.
... choose multiple tags, but only with OR, and not AND
- in "Match" menu
- "any" means OR"
- "all" means AND
zarlan wrote: Thu Apr 14, 2022 11:30 am There should be a way to filter/search by multiple tags and, very importantly, exclude tag.
- In categories filter, you can select more than one category with "Ctrl" click to specify multiple tags
- Use "Alt" click to exclude a tag

2) Quick search field is another way to make searches , only on displayed pictures (but you can first choose recursive viewing)
Settings are in Tools>Settings>Browser>Quick Search window.
Here you can use regular expressions such as blue | green to search blue OR green
(another example : blue.*green|green.*blue , to search blue AND green, but that works only inside a unique field, not in tags list)

3) Search menu
Here you can build a multiple AND query, or a multiple "OR" query

5) For complex sql queries you can download DB Browser for SQLite
zarlan
Posts: 53
Joined: Thu Apr 14, 2022 10:33 am

Re: tag/categories search/filter

Post by zarlan »

michel038 wrote: Sat Apr 16, 2022 8:55 pm- At the top of categories filter pane, click on "Match" ...
Here you can choose whole database, or current folder, or current folder recursive.
Yes, but that doesn't cover "multiple folders. (with options for including sub-folders, and when including subfolder, also having the option to exclude specific sub-folders)"
- in "Match" menu
- "any" means OR"
- "all" means AND
If only one tag can be chosen, in the categories filter panel, that makes those "any" and "all", completely irrelevant and unusable.
- In categories filter, you can select more than one category with "Ctrl" click to specify multiple tags
:!:
Indeed!
Well, in that case, the "any" and "all" you mentioned above, is useful!
- Use "Alt" click to exclude a tag
I tried that, and no it doesn't.
Ctrl-Alt does, however!

It only works with using OR or AND on ALL chosen tags, though
You can't do stuff like "A AND B XOR C" (not to mention "A AND (B XOR C))
Thus my suggestions would still be an improvement

…though the panel-suggestion appears to already, kinda, exist.
That said, what I suggested involves a much more simple, smooth, and intuitive interface.
The current way of doing it, in the categories filter panel, is a bit awkward …and with no hint or indication, anywhere, that one can do any of that.
If the categories filter panel were to work in the way the panel I suggested would work (i.e. click once to include, twice to exclude, and a third time to return it to being unmarked), would probably be better
…and linking it to a filter/search bar (where chosen tags get added, in accordance with how they are marked), where one can use boolean operators, to further adjust the search/filtering, wouldn't hurt.
2) Quick search field is another way to make searches , only on displayed pictures (but you can first choose recursive viewing)
Settings are in Tools>Settings>Browser>Quick Search window.
Here you can use regular expressions such as blue | green to search blue OR green
:!:
Really? That sounds great!
Which regular expressions, and what's the syntax? (aside from | for OR, that you've already mentioned, of course. Can ^ be used for XOR, or does it have a different syntax? [or is there no XOR?] What is AND and NOT? Which exact wildcards are used?)
(another example : blue.*green|green.*blue , to search blue AND green, but that works only inside a unique field, not in tags list)
Uh…
What?
That makes no sense to me.
* is typically a wildcard, representing zero or more characters of any kind …which doesn't make sense, at all, in that example.
Given the context, I'll assume that the period is… AND?
How/why one would choose a period, to represent AND…
…and what's with the kinda doubled and mirrored sets of "blue" and "green", connected with an OR?

If you could explain the syntax to me, that would be great.
It might even be all of what I've asked for. (from what you say, it seems to be, at a minimum, a large part of it)
…and what do you mean by "but that works only inside a unique field, not in tags list"? What "unique field" are you talking about?
(if you mean the area(s) specified at Tools>Settings>Browser>Quick Search… Well that can include, or exclusively be, tags. So it wouldn't necessarily be specifically only tags that are searched through, in that case. Less specific, if more than the catalog is chosen to be searched through [personally, I've unmarked everything except the catalog, however], but otherwise what I was describing)

Also…
The Quick Search bar allows for searching file names. (I assumed that was all it did)
How do you distinguish between searching in filenames and searching in tags? (and can one specify more than filenames and tags? and if so, what and how?)
…and it seems to look for any files with filenames containing what one writes. Is it possible to specify that it must start or end with it, or even match? Or specify that it be in the extension, or outside of the extension?
3) Search menu
Here you can build a multiple AND query, or a multiple "OR" query
Ehm…
I took at look at it, and it certainly looks very interesting, and one can specify a lot more than just tags, which is great (being able to specify file type and date, is really great), but…
…but aside from the limitation of only allowing all AND or all OR… (despite an interface that could easily allow for specifying AND and OR individually, with minimal adjustment)

It is extremely unintuitive and confusing. (and with no manual/documentation/instructions)
(I was about to complain that it demands you write a filename, and doesn't allow for mentioning categories, until I took a closer look …and even after a closer look, I am quite confused)

Also, if one chooses to add a category, one cannot see the category chosen. Just "Categories". (you have to clicks on it, to see the category/categories chosen)
This does allow for multiple categories being chosen, represented by just one line …but actually having a line for each category, with the category visible would be a lot better. It would allow for a far greater/clearer overview.
5) For complex sql queries you can download DB Browser for SQLite
Eh…
No.
There are two problems with that:
1. You don't get the XnViewMP-interface, thumbnails, or ability to see or access the files.
You just get the filepaths, that you have to manually access, one by one.
2. That would only work, if one has a working knowledge of SQL. Otherwise, trying to browse the SQLite database is utterly hopeless …which I know, from experience.

That said, if the quick search bar allows for AND, NOT, OR, XOR, and parentheses, in the way I mentioned…
Then that means that it already does what the search/filter bar I describe, would do.
That would be really great!
zarlan
Posts: 53
Joined: Thu Apr 14, 2022 10:33 am

Re: tag/categories search/filter

Post by zarlan »

I'd like to note, aside from how I haven't gotten any explanation of how quick search can "search" in tags (I certainly can't get it to work), and what regular expressions can be used and with what syntax…
Furthermore, the "quick search"-bar, doesn't search, at all.
It filters.
There is quite a significant difference.
When I browse, and I press on a number/letter, I am taken to an image whose filename starts with that letter (in File Explorer, I can press more than just one character, to get to a file that starts with those initial 1-3 characters. In the file explorer I use in Linux, I get a little bar that pops up, where I can write as much as I'd like, and even press ctrl-v to paste in a filename, to get to that file), and that is more fair to call a search, though it is sadly limited.
I can find a file with more of the filename, by using "quick search", but that removes all the other images from the browser. This can be useful at times, and problematic at others. Having a "quick search"-bar, that actually just directs you to such files (and allowing for going to the next/previous result) within the images browsed, with a separate filter bar, would be nice.
(also, excluding one tag, with no other tags marked, doesn't show all images that don't have that tag, but instead shows nothing) :bug:

Having used ctrl, and ctrl+alt, in the Categories panel, I have found that it works in a rather awkward manner, and it is difficult to manage to get it to have the right set of tags included/excluded. It can be relatively easy, if you're just including tags, particularly if they're all close to each other, but…
It would work a lot better and smoother, if it worked the way I propose:
Click on a tag, to include, click on it again to exclude, and once more to unmark it.
Further, adding folders (for marking as included/excluded) to the Categories panel, along with "Ratings", "Colour Label", "People", "Special Items", "Album" (none of which I use, BTW), and "Categories", and treating them the same, in terms of marking/including/excluding, would be great. Far better than just the "Global", "Current folder", and "current folder (recursive)".
…and speaking of recursive, being able to right click on an item on the Categories panel, to get a context menu where you have the choice to include sub-tags/sub-folders/… or exclude all sub-X, would also be good.

…and have a filter bar, linked to it, where all the items you include/exclude in the Categories panel are automatically included (and all those you include in the filter bar, automatically get marked in the Categories panel), and where you can use further regular expressions, to include OR, XOR, and parentheses, to further refine the filtering.