Searching on integer attributes

If you’re creating custom attributes for your files, you’ll almost always want to give them a datatype of „string.“ However, for some purposes, you’ll want to use integer values. If you do this, and you want to be able to search on those attributes later, you need to take care to create the right type of index. If you simply type

mkindex <attributename>

you won’t get any results in your queries because mkindex will assume you’re making a string index. Instead, use the -t flag with mkindex to specify its datatype, e.g.

mkindex -t int <attributename>

Now you’ll get search results on your integer queries. Note that integer queries have to do numeric comparisons — wildcards won’t work. In other words, if you have a value of 554, you can’t search on *5* , but you can search on >=55 or <= 55 or ==554 .



No comments so far.

(comments are closed)