In addition to searching by name, applications can search for files and directories based on their File Tags (metadata) using the CBFS Storage query language.
The query language includes a wide variety of Language Elements and supports all common Data Types. Search queries are interpreted as UTF-16LE strings, and may contain any valid arrangement of language elements, typed file tag names, and constants. For example:
- From = 'John Smith': Selects all files received from John Smith.
- From is the name of a file tag.
- = is the equality operator (== is also supported).
- 'John Smith' is a string constant.
- SendData - Today > 3: Selects all files which were sent over 3 days ago.
- SendData is the name of a file tag.
- - is the subtraction operator.
- Today is an intrinsic constant which returns the current system date.
- > is the greater than operator.
- 3 is a numeric constant.
When parsing an expression from a search query, the query engine converts all of its operands to the same data type using a specific set of rules; please refer to the Type Conversion topic for more information.
To find the first match for a query, call the FindFirstByQuery method, passing the desired search query for the Query parameter; and then call FindNext to find other matches, if necessary. Be sure to call FindClose when finished so that the component can release the resources allocated for the search operation.
Please refer to the File Tags topic for more information about how to manage file tags, and please refer to the other topics in this section for more information about the query language: