Manipulating filesystem indexes

In order to run a system query, at least one of the attributes of the filetype being searched on must be indexed by the system. BeOS does not index every attribute of every filetype because that would result in an impact on performance. You can see which attributes are currently being indexed by opening a Terminal and typing


If you want more details on the lsindex output, use

lsindex -l

If you want to search on an attribute that isn’t currently being indexed, you can create a new index by typing

mkindex [attribute_name]

For example, let’s say you’ve associated an attribute with an internal name of META:Author with your text/plain filetype, and you want to be able to search your system for text files authored by a certain person. Type:

mkindex META:Author

From now on, all new text files that you create will have their META:Author attribute added to the META:Author index.
The datatype of a new index is „string“ by default. If the attribute involves numbers and you want to do numerical searches on those numbers, you’ll need to make sure you create an index of type „int“. For example, if you’re creating a „year“ attribute and corresponding index, and you want to search on files with a year index between 1973 and 1977, use something like:

mkindex -t int TEXT:Year

There are, however, two things to note:
1) New indexes are not retroactive — if you have a ton of text files with Author attributes, they won’t be automatically added to the new index. To have old files added, just use the Tracker to copy (not move) them to a new location. The act of copying them will add their attributes to the new index.
2) A newly created attribute will not become immediately visible in the Find panel unless you give it a friendly name (a description) in the FileTypes panel, and restart the Tracker (or reboot).



No comments so far.

(comments are closed)