All docs
This doc
Function |
|
---|---|
Description | Returns all records which match the given search query and sort them by the given sortBy parameters. records can be sorted by multiple fields. If two records have the same value for a specific sorting field, it will consider the second field to sort. |
Output | A JSON String array containing the records in the ‘message’ element within the argument of the success callback. |
var queryInfo = { tableName : "TEST", //table being queried searchParams : { query : "column1:value1", //lucene query to search the records start : 0, //starting index of the matching record set count : 100 //page size for pagination sortBy : [ { field : "column1", //this column will be used to sort the records in DESC order sortType : "DESC" }, { field : "column2", // if there are records with the same value for field "column1" then this field ( "column2" ) will be considered to sort only those records sortType : "ASC" } ] } }; client.search(queryInfo, function(data) { console.log (data["message"]); }, function(error) { console.log("error occured: " + error); });
[{ "id":"14399961246350.13125980939205978", "tableName":"TEST","timestamp":1439996124610, "values":{ "column1":"value1", "column2":"value2" } }, { "id":"14399961246350.13125980939205999", "tableName":"TEST","timestamp":1439996124610, "values":{ "column1":"value1", "column2":"anotherValue2" } } ]