@@ -9,17 +9,21 @@ public class Search extends AbstractVarArgFunction<List<SearchResult>> {
99 @ SuppressWarnings ("rawtypes" )
1010 @ Override
1111 public List <SearchResult > run (List arg ) throws Exception {
12- String term = (String ) arg .get (0 );
13- Integer limit = (Integer ) arg .get (1 );
14- String database = (String ) arg .get (2 );
15- String table = (String ) arg .get (3 );
16- if (term == null )
12+ try {
13+ String term = (String ) arg .get (0 );
14+ Integer limit = (Integer ) arg .get (1 );
15+ String database = (String ) arg .get (2 );
16+ String table = (String ) arg .get (3 );
17+ if (term == null )
18+ throw new Exception ("$search(term, limit?, database?, table?)" );
19+ if (database != null && table != null )
20+ return this .expressionService .getData ().search (this .sc , database , table , term , limit );
21+ if (database != null )
22+ return this .expressionService .getData ().search (this .sc , database , term , limit );
23+ return this .expressionService .getData ().search (this .sc , term , limit );
24+ } catch (ClassCastException e ) {
1725 throw new Exception ("$search(term, limit?, database?, table?)" );
18- if (database != null && table != null )
19- return this .expressionService .getData ().search (this .sc , database , table , term , limit );
20- if (database != null )
21- return this .expressionService .getData ().search (this .sc , database , term , limit );
22- return this .expressionService .getData ().search (this .sc , term , limit );
26+ }
2327 }
2428
2529 @ Override
0 commit comments