docs: function (condition) {
          var query = condition.query;
          var mainType = condition.mainType;
  
          var queryCond = getQueryCond(query);
          var result = queryCond
              ? this.queryComponents(queryCond)
              : this._componentsMap.get(mainType);
  
          return doFilter(filterBySubType(result, condition));
  
          function getQueryCond(q) {
              var indexAttr = mainType + 'Index';
              var idAttr = mainType + 'Id';
              var nameAttr = mainType + 'Name';
              return q && (
                      q[indexAttr] != null
                      || q[idAttr] != null
                      || q[nameAttr] != null
                  )
                  ? {
                      mainType: mainType,
                      // subType will be filtered finally.
                      index: q[indexAttr],
                      id: q[idAttr],
                      name: q[nameAttr]
                  }
                  : null;
          }
  
          function doFilter(res) {
              return condition.filter
                      ? filter(res, condition.filter)
                      : res;
          }
      }