public static SuggestedItem find ( SearchIndex index , String query , SearchableModelObject searchContext ) { List < SuggestedItem > r = find ( Mode . FIND , index , query , searchContext ) ; if ( r . isEmpty ( ) ) { return null ; } else if ( 1 == r . size ( ) ) { return r . get ( 0 ) ; } else { // we have more than one suggested item, so return the item who's url // contains the query as this is probably the job's name return findClosestSuggestedItem ( r , query ) ; } }
Performs a search and returns the match or null if no match was found or more than one match was found .