Using query language

To provide additional capabilities to file search, CBFS Storage query language was introduced. It allows user to select files by their metadata (file tags).

Main language elements are its Data Types and Operators. The latter table also contains built-in functions.

Search queries are UNICODE strings constructed of language elements and conatants.

  • "From = 'John Smith'" - here From is a name of the file tag, 'John Smith' is a UNICODE constant. This query selects all files received from John Smith.
  • "SendDate - Today > 3" - here SendDate is a name of the file tag, Today is an intrinsic constant. This query selects all files which were sent more than 3 days before.

When parsing the query, CBFS Storage converts all its operands to the same data type. Type conversion rules are described in the section: Type conversion in CBFS Storage query language.

Specify tag names and data types using AddTagName method.
Use SetFileTagAs* (where * denotes tag data type) functions to set values of file tags.
Use GetFileTagAs* (where * denotes tag data type) functions to retrieve file tag values.
Note, that string tags may contain ANSI string values, while CBFS Storage query language operates with UNICODE strings only. It is recommended to use only ASCII characters for ANSI string tags.

To find a first match to the query, call FindByQueryFirst method with a corresponding Query parameter. To find other files matching the query, use FindByQueryNext function. Don't forget to release allocated resources by calling FindByQueryClose.