Search

Catalyst Search enables data searching in the indexed columns of the tables in the Data Store . It allows you to perform powerful searches through volumes of data with a single search query.

Search Data in Tables

The search() method is used for searching data in the tables in a specific pattern. Before you execute a search operation, you must construct the search pattern to pass to the search() method, as shown in the code syntax below.

    
copy
ZCatalystApp.getInstance().search( searchOptions: ZCatalystSearchOptions, success: (Map<String, List<Map<String, Any?>>>) → Unit, failure: ((ZCatalystException) → Unit)? ): ZCatalystRequest<ZCatalystResponse<Map<String, List<Map<String, Any?>>>>>?

Parameters:

  • searchOptions: The instance of the ZCatalystSearchOptions class to be passed to the search() method

You can create the instance for searchOptions() in the following way:

    
copy
ZCatalystSearchOptions(searchText: String, ArrayList<ZCatalystSearchOptions.TableColumns) .addSortColumn(tableName: String,columnName: String): Unit .setDisplayColumns(displayTableColumns: ArrayList<ZCatalystSearchOptions.TableColumns>): Unit .setSearchColumns(searchTableColumns: ArrayList<ZCatalystSearchOptions.TableColumns>): Unit .setSearchPattern(pattern: ZCatalystSearchOptions.SearchPattern): Unit

A sample code snippet of a search execution is shown below:

    
copy
val tableColumns = ZCatalystSearchOptions.TableColumns("EmployeeDetails") //Replace this with your table name tableColumns.addColumn("Age") //Replace this with your column name val arr = arrayListOf() arr.add(tableColumns) val searchOptions = ZCatalystSearchOptions("26",arr) //Replace this with your search text ZCatalystApp.getInstance().search(searchOptions, { println(">> success - $it") }, { println(">> failed - $it") })