Hi,
I've just figured out the answer to my prior question so I thought I'd share it here for anyone interested.
Basically, the reason why I was getting an empty search result was because my logical not operator wasn't properly specified. Here is the way to query untagged permanodes:
```
{"logical": {"op":"not", "a":{"permanode":{"attr": "tag", "valueMatches":{"ByteLength":{"Min":1}}}}}}
```
The top-level key should be "logical", and the value should model a
LogicalConstraint.
Now this returns blobs when using `pk search` CLI, but in the UI, an error message appears because non-permanodes are in the result set. So we need to add an additional constraint that only permanodes should be returned:
```
{"logical": {"op":"and", "a":{"permanode":{"anything": true}}, "b":{"logical": {"op":"not", "a":{"permanode":{"attr": "tag", "valueMatches":{"ByteLength":{"Min":1}}}}}}}}
```
Now I wanted to chain this with the "is:image" predicate but it doesn't mix with raw queries, so I had to do this to search all untagged images:
```
{"logical": {"op":"and", "a":{"permanode": {"attr": "camliContent", "valueInSet": {"file": {"isImage": true}}}}, "b":{"logical": {"op":"not", "a":{"permanode":{"attr": "tag", "valueMatches":{"ByteLength":{"Min":1}}}}}}}}
```
I figured out the "is:image" constraint by looking at the
source code.
Anyways, I feel like an "is:untagged" predicate would be a handy predicate to support, so I'll see about contributing a PR soon. For now, I can enjoy importing and tagging my photo collection in perkeep :)
Thanks,
--Alex