Hello everyone, I’m struggling trying to get results querying an indexed boolean attribute, in the specific case MAIL: priority, if I try
Tried with = and ==
Tried upper and lower case
Tried > 0
Nothing to do
The only results I get is with
=* Or ==*
But this won’t work in combination with other criterias, i.e. ((META:from==“dude”)&&(META: priority=*))
Is it my fault or should I open a ticket?
Tnx in advance
It’s been a really long time since I’ve used the BeOS/Haiku mail app but I think that value gets stored as a string. Have you checked the index type with the command
lsindex -v ?
More knowledgeable people may correctme, but it looks to me as if boolean attributes cannot be indexed and therefore queried. The
mkindex command does not know the type ‘bool’ and under
fs_create_index() the BeBook says:
type indicates the kind of data the attribute will contain. Standard types are defined in the
support/TypeConstants.h header file. Different file systems may support different types. BFS supports the following types of attributes:
I tried using ‘int’ as type to create the index, but that didn’t seem to work.
It looks like you should use an INT instead of BOOL when creating your filetype.
Ok, i read the source of mail_daemon and it sets that attribute as string, but I’m missing, conceptually, the point: for me a priority is equal to “urgentness”, so the possible values should be yes or no; I solved with a WA, converted the attribute to int so now I have the special character “!” in tracker when that attribute is > 0, and this works in queries too, ‘MAIL: priority>0’ give results even with other criterias, so I guess a boolean type is futile, at last if it’s meant if I want to made it searchable
Yes, I found it by myself, obviously I had to remove the previous mail:priority index because it was defined as a string index, then made it as a ‘int’ and reindexed my mails, so it’s been solved with this work-around, tnx
Maybe using ‘string’ for the priority was due to the problem of localization of attributes when shown in Tracker. I don’t seem to have any mails with a priority attribute. Does the mail_daemon fill those attributes with “high”, “low”, “urgent” etc. (or the localized equivalent)?
Beats showing some number constant, but gets awkward when changing locales…
I gave a quick look to the source and it seems mail_daemon doesn’t extract that attribute so probably it’s been set for a future implementation, i don’t know, I’m just playing around with some script and it seemed useful for some ideas