Searches for the first file or directory whose file tags match the specified query.
__int64 __fastcall FindFirstByQuery(String Directory, String Query, int Flags);
This method initiates a search operation within the specified Directory for files and subdirectories whose typed file tags match the specified Query. If there are any matching files or directories, then a search operation handle pointing to the first result is returned. If there are no matching files or directories, then -1 is returned.
To obtain information about a search result, pass the returned search handle to the following methods:
To retrieve the next search result, pass the returned search handle to the FindNext method. When an application is finished with (or wants to abandon) a search operation, it must pass the associated search handle to the FindClose method in order to release the resources associated with it.
Since each search operation is identified by the search handle associated with it, applications may initiate additional search operations at any time, and may process each operation's search results in any manner it desires (sequentially, round-robin, etc.).
The value passed for Directory must be a vault-local absolute path.
The value passed for Query must be a search query constructed using the CBFS Vault Query Language; please refer to that topic for more information.
The Flags parameter controls search behavior. Among other things, it can be used to request that only specific pieces of information be returned, which can greatly improve performance. The value passed for this parameter should be constructed by OR'ing together zero or more of the following values:
|Include entry names (without paths) when returning search results.
|Include fully-qualified entry names when returning search results.
|Include entry attributes when returning search results.
|Include entry sizes when returning search results.
|Include entry metadata sizes when returning search results.
|Include entry times when returning search results.
|Include symbolic link destinations when returning search results.
|Inserts . and .. pseudo-entries into search results for all directories except the root one.
|Search recursively in all subdirectories.
|Forces case-insensitive search, even if the vault is case-sensitive.
Note: This method can only be called when Active is true, and cannot be called within events.