public static void performFullTextSearch()
throws Exception
{
// Catalog a test file.
catalogTextFile();
// Get a searcher manager object.
Searcher searcher = Connector.getSearcher();
// Create the query object.
Query query = new Query( ObjectType.ASSET );
// Add typical return attributes.
query.addReturnAttribute( "uuid" );
query.addReturnAttribute( "name" );
query.addReturnAttribute( TextSearchMgr.SCORE_VAR );
// Add the condition to look for the text "APIExample".
query.addTextQuery( "APIExample" );
// Set the result window.
query.setResultWindow( 0, 40 );
// Catch any exception.
QueryResult queryResult = null;
try
{
// Now execute the query.
queryResult = searcher.search( s_userAuth, query );
}
catch (Exception e)
{
// Report the exception.
System.out.println( "\nException thrown while performing full text search: " + e.getClass().getName()
+ "\n " + e.getMessage() + "\nVerify that the FAST search server is properly configured" );
return;
}
}