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.

Note: The columns you search for data must be indexed. You can enable search indexing for a column while creating it or by editing it later.

Search Data in Tables

To search for data in a table in a specific pattern, you must specify the table name as the identifier, and add the columns to be searched in. The columns can be added to an array and the array must be passed to the search() method along with the keywords to be searched through an instance of the class ZCatalystSearchOptions.

You must construct the search pattern to pass to the search() method before you execute a search operation, 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") })

Last Updated 2023-09-03 01:06:41 +0530 +0530