Hi Udara,

Yes, your way of calling search API is the correct way. Documentation needs
to be updated. Thank you for pointing it out.

@Rukshani, can you please replace the example with the following content?

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

     }

};


client.search(queryInfo, function(data) {

        console.log (data[“message”]);

}, function(error) {

        console.log(“error occured: ” + error[“message”]);

});


Highlighted text is missing in the current Docs.

Thanks,

On Sunday, December 27, 2015, Anjana Fernando <[email protected]> wrote:

> @Gimantha, please check.
>
> Cheers,
> Anjana.
>
> On Sat, Dec 26, 2015 at 8:52 PM, Udara Rathnayake <[email protected]> wrote:
>
>> Hi,
>>
>> I tried following doc[1] to retrieve records using a simple lucene
>> query(userId:udarakr) via JS API.But noticed an error, when I use the same
>> query within data explorer it works perfectly.
>>
>> Then did some debugging on portal/controllers/apis/analytics.jag &
>> portal/js/carbon-analytics.js,  found we are expecting queryInfo object in
>> a different format than in the doc[1].
>>
>> portal/js/carbon-analytics.js - LINE 473
>>
>>     this.search = function (queryInfo, callback, error) {
>>         jQuery.ajax({
>>                         url: this.serverUrl + "?type=" + TYPE_SEARCH +
>> "&tableName=" + queryInfo["tableName"],
>>                         data: JSON.stringify(queryInfo["searchParams"]),
>>                         type: HTTP_POST,
>>                         success: function (data) {
>>                             callback(data);
>>                         },
>>                         error: function (msg) {
>>                             error(msg[RESPONSE_ELEMENT]);
>>                         }
>>                     });
>>     };
>>
>>
>> As per above we need to provide queryInfo Object like,
>>
>> Eg:-
>>                 var queryInfo={
>>                     tableName:"LOCATION",
>>                     searchParams : {
>>                         query:"userId:udarakr",
>>                         start:0,
>>                         count:100
>>                     }
>>                 };
>>
>> If this is the correct way, Shall we update the docs?
>>
>> [1]
>> https://docs.wso2.com/display/DAS300/Retrieving+All+Records+Matching+the+Given+Search+Query+via+JS+API
>>
>> --
>> Regards,
>> UdaraR
>> ​​
>>
>>
>
>
> --
> *Anjana Fernando*
> Senior Technical Lead
> WSO2 Inc. | http://wso2.com
> lean . enterprise . middleware
>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to