The simplest way to construct a search query is to use the RAMSession.createAssetQuery(String) method. You can pass any string that you would type into the search input box in the web or Eclipse client. Or you can paste a search shortcut found under the Search text box on the web client.

In the Eclipse client you can get a search shortcut using the Copy to Clipboard from the drop down menu on the in the asset search view.
The createAssetQuery method will return a RAMAssetQueryBuilder object casted down to the simplified SeachQuery object. This object can be passed to the method RAMSession.getAssets(SearchQuery) and it will return a RAMSearchResult object casted down to the common SearchResult object. From the SearchResult object you can get the total number of assets that meet this search query along with a list of RAMAsset objects for this page of results.
Here is an example of a simple search for all assets that match the words "Rational Asset Manager" and "javadoc":
SearchQuery query = session.createAssetQuery("Rational Asset Manager javadoc");
SearchResult searchResult = session.getAssets(query);
RAMAssetSearchResult[] assets = (RAMAssetSearchResult[])searchResult.getAssetSearchResults();
You can use synchronized search, or real time search, to ensure that search results are synchronized with the database. Use the SYNCHRONIZED_SEARCH_FLAG flag to enable real time searches.
When you use synchronized search, the results that are returned from the index match the content of the database at the time the query was submitted. Synchronized searches might take longer than normal searches because the request must wait for the index to be synchronized with the database if there were recent updates to the system.
Here is an example of a synchronized search:
RAMAssetQueryBuilder query = (RAMAssetQueryBuilder)session.createAssetQuery("Synchronized Search Test");
query.setSearchModes(SearchQuery.SYNCHRONIZED_SEARCH_FLAG);
SearchResult searchResult = session.getAssets(query);