Tracker Queries - search for null or empty extended attribute

There is any way to query for files, looking for an especific parameter that is null or empty?

In the attached picture, I provided two very similar queries. The only difference, is that one of them, looks for Mp3 files that have a rating = 5, and the second one, looks for files that have a rating less than 5.

The query that looks for rating = 5, works well.
However, the other one, that looks for rating less than 5, don’t find anything.

The second one, is not supposed to found any mp3 file that don’t have any rating?

I also tried with rating = 0, and rating = null, but also don’t find any files. Maybe could be useful to add an option to search for an attribute that is not settled or is null.

You need to switch to search “by formula” instead of “by attribute” to accomplish this. It you enter the values as you did above in “by attribute” mode and then switch to “by formula”, the formula field will be pre-filled with the chosen attribute. Then just change it to:

((Media:Rating== ?* ) && (BEOS:TYPE==“audio/mpeg”)) for any value set
((Media:Rating!= ?* ) && (BEOS:TYPE==“audio/mpeg”)) for no value set

This is consistent with BeOS. However, I agree it would be nice to have an easier alternative by choosing “has value” / “without value” or similar in the attribute search mode.

1 Like

First, as always, make sure all your files actually got a chance to be added to the index. :slight_smile:
I, for example, had some audio files that were lying around since before that Media:Rating index was created. Best to duplicate the music folder and remove the original, just to be sure.
Querying for ratings less/greater than 5 does work for me (in attribute mode).

Things to keep in mind:

  • Media:Rating goes from 1-10, i.e. evey two steps one star. A rating of “1” is “★☆☆☆☆”. But so is a ratingof “2”… We need half-stars. :slight_smile:
  • Files that were not yet rated, don’t have a Media:Rating attribute at all. Tracker just shows that as “☆☆☆☆☆”, the same as a rating of “0”. You cannot query for files without the Media:Rating attribute.
1 Like

Hi, thanks for your answers! As @humdinger said, I guess the issue is because what I’m looking for is files without that attribute.

I’m trying to use the examples provided by @Jim, but aparently doesn’t work: basically in all the cases always retrieve files with any rating, with the exception of the null ones:

I also tried some variant from the !=?*, like !=?, but without sucess:

Hm, not sure why its not working for you, a similar query seemed ok when I tried on my image files with the same Rating attribute. I will take another look later in the weekend.

Btw, to create the index attribute for old files, you could also use the ‘reindex’ command from the terminal.

I did some more testing and it seems *? works fine for text attributes, but actually I cannot get the expected result on the integer attributes like Media:Rating - either the attribute is not set on the file or the attribute will store empty as ‘0’ (at least when editing the Rating using Tracker). So mass-updating the rating to ‘0’ or ‘-1’ for all audio files on the drive with a missing Media:Rating attribute seems necessary in your case i :frowning: