Searching
You can search for item versions using either the
Latest Versions for Location
search mode or the
All Versions in Database
search mode — see
Searching Versions
. The search term can contain both plain search words and any number of filter expressions written using
The Model Manager Search Syntax
.
To quickly see how to express a particular filter using the Model Manager search syntax, specify values in the
Filter
dialog box for that filter and inspect the corresponding text shown under
Filter query preview
. See also
The Filter Dialog Box
.
Examples
Search for the latest versions of all drafts on a branch that are assigned the tag
My Project
.
SearchBranchItemResultStream resultStream = branch
.searchItems("@itemSaveType:draft @tag:\"my project\"");
Field expressions in the Model Manager search syntax are automatically combined with
AND
-logic unless an explicit boolean operator is provided — see
Table 3-5
.
You can also write the previous code using a parameter object for which the two filters are provided as separate string arguments to the
withSearchFilters
method.
SearchItemsForBranchParamGenerator p = DatabaseApiUtil.param()
.forSearchItemsForBranch()
.withSearchFilters("@itemSaveType:draft",
"@tag:\"my project\"");
SearchBranchItemResultStream resultStream = branch.searchItems(p);
Search for all versions in the database that were saved with a commit comment containing the word
solved
. Sort the search result on the size of
Built, Computed, and Plotted Data
.
SearchItemVersionsParamGenerator p = DatabaseApiUtil.param()
.forSearchItemVersions()
.withSearchFilters("@commitComment:solved")
.withSortByComputedData()
.withSortDescending();
SearchItemVersionResultStream resultStream = database
.searchItemVersions(p);
Advanced Database Operations Using Parameter Objects