Hi,

Another small update, We have start and count parameters within
following[1]. I think these two parameters are misleading as we are
retrieving total count(number of matching records)

curl -X POST -H "Content-Type: application/json" -H "Authorization: Basic
YWRtaW46YWRtaW4=" -v https://localhost:9443/analytics/search_count -d
'{"tableName":"ORG_WSO2_DAS_SAMPLE_SMART_HOME_DATA",
"query":"state:Texas", "start":0,
"count":3}' -k


[1]
https://docs.wso2.com/display/DAS301/Retrieving+the+Number+of+Records+Matching+the+Given+Search+Query+via+REST+API

On Sun, Dec 27, 2015 at 4:31 PM, Udara Rathnayake <[email protected]> wrote:

> Hi Team,
>
> One more thing, within the example code snippet we are not using proper
> quotation mark(U+0022). For me it looks we are using double prime
> character(U+02BA). Check the highlighted portion.
> If someone try to copy and paste the exact same, this can cause issues.
> Better if we can update this also.
>
> var queryInfo = {
>     tableName : “TEST”, //table being queried
>     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”]);
> });
> “error occured: ” + error[“message”]
>
> This anomaly exists on most of the analytic JS API docs. Sorry for the
> trouble guys.
>
> On Sun, Dec 27, 2015 at 12:17 PM, Anjana Fernando <[email protected]> wrote:
>
>> Hi Gimantha,
>>
>> I think you've access to the docs wiki. Please change it directly.
>>
>> Cheers,
>> Anjana.
>>
>> On Sun, Dec 27, 2015 at 9:47 PM, Gimantha Bandara <[email protected]>
>> wrote:
>>
>>> 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
>>>>
>>>
>>
>>
>> --
>> *Anjana Fernando*
>> Senior Technical Lead
>> WSO2 Inc. | http://wso2.com
>> lean . enterprise . middleware
>>
>
>
>
> --
> Regards,
> UdaraR
>



-- 
Regards,
UdaraR
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to