AnsweredAssumed Answered

How to filtering types by properties in JavaScript controller using the Alfresco Search WebScript?

Question asked by Aleksey Bykov on Apr 25, 2017
Latest reply on Apr 27, 2017 by Aleksey Bykov

For example, I have a type "Contract":


<type name="some-prefix:contract">

This type contains an aspect:


<aspect name="some-prefix:resolution">
        <property name="some-prefix:isCoordinated">

By using this aspect, I set the state of the contract and trying to retrieve approptiate node:


getParameters : function Contract_getParameters() {
     var param = "term=";
     var query = "+TYPE:some-prefix\\:contract";
     if (this.widgets.filter.value == "inactive")
          query += " +@some-prefix\\:isCoordinated:false";
          query += " +@some-prefix\\:isCoordinated:true";
     param += encodeURIComponent(query);
     return param;

getWebscriptUrl : function Contract_getWebscriptUrl() {
     return Alfresco.constants.PROXY_URI + "slingshot/search";

If I use only this part, then I get the whole list of contracts:


var query = "+TYPE:some-prefix\\:contract";

But if I add an additional condition, for example:


query += " +@some-prefix\\:isCoordinated:true";

Then in this case I get an empty list.


By using the Node Browser I found, that my query works:


+TYPE:some-prefix\:contract +@some-prefix\:isCoordinated:true

But when I call Alfresco Search WebScript from JavaScript controller I get the following:


     "totalRecords": 0,
     "totalRecordsUpper": 0,
     "startIndex": 0,
     "numberFound": 0,

What could be the reason?..


I would be very grateful for the information. Thanks to all.