The latest version for DAS is WSO2 Data Analytics Server 3.1.0. View documentation for the latest release.
WSO2 Data Analytics Server is succeeded by WSO2 Stream Processor. To view the latest documentation for WSO2 SP, see WSO2 Stream Processor Documentation.

All docs This doc
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
||
Skip to end of metadata
Go to start of metadata

Overview

Function

search (queryInfo, success, error)

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.

OutputA JSON String array containing the records in the ‘message’ element within the argument of the success callback.

Example

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); 
});

Sample output

[{
    "id":"14399961246350.13125980939205978",
    "tableName":"TEST","timestamp":1439996124610,
    "values":{
        "column1":"value1",
        "column2":"value2"
    }
},
{
    "id":"14399961246350.13125980939205999",
    "tableName":"TEST","timestamp":1439996124610,
    "values":{
        "column1":"value1",
        "column2":"anotherValue2"
    }
}
]
  • No labels