message: making buildQueryExpression recursive to prepare for has-many
diff: @@ -76,8 +76,11 @@ module.exports = declareInjections({
  let segments = key.split('.');
  let partialPath = '';
  let currentContext = ['search_doc'];
  + return this._buildQueryExpression(schema, segments, errorHint, partialPath, currentContext);
  + }
  - while (segments.length > 0) {
  + _buildQueryExpression(schema, segments, errorHint, partialPath, currentContext) {
  + let [ first, ...rest ] = segments;
  let fieldName = segments.shift();
  let field = schema.realAndComputedFields.get(fieldName);
  if (!field) {
  @@ -87,7 +90,7 @@ module.exports = declareInjections({
  });
  }
  - if (segments.length > 0) {
  + if (rest.length > 0) {
  if (!field.isRelationship){
  throw new Error(`Cannot ${errorHint} by unknown field "${partialPath}${fieldName}.${segments[0]}"`, {
  status: 400,
  @@ -97,13 +100,11 @@ module.exports = declareInjections({
  if (field.fieldType === '@cardstack/core-types::has-many') {
  throw new Error("unimplemented");
  } else {
  - currentContext = ['(', ...currentContext, ')->', { param: field.id } ];
  + return this._buildQueryExpression(schema, rest, errorHint, `${partialPath}${first}.`, ['(', ...currentContext, ')->', { param: field.id } ]);
  }
  } else {
  - currentContext = field.buildQueryExpression(currentContext);
  - }
  + return field.buildQueryExpression(currentContext);
  }
  - return currentContext;
  }
  fieldFilter(branch, schema, key, value) {
  @@ -219,3 +220,4 @@ function queryToSQL(query){
  values
  };
  }
  +
  