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
​​
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to