and(attribute, operator, value, boost)

Adds an “and” subquery to the given ObjSearch instance.

Compares the attribute value(s) with the given value(s) using the operator of this subquery. All CMS objects to which this criterion does not apply are removed from the result set.

Params

  • attribute (String or Array<String>) – Name(s) of the attribute(s) whose values are to be searched. For arrays, the subquery matches if one or more of these attribute values meet this criterion.
  • operator (String) – See Search operators.
  • value (String, Date, Time, Number, Obj, or Array) – The value(s) to compare with the attribute value(s) using the operator of this subquery. For arrays, the subquery matches if the condition is met for one or more of the array elements.
  • boost (optional) (Object) – A hash where the keys are attribute names and their values are boosting factors. Boosting factors must be in the range from 0.1 to 10. Boosting can only be applied to subqueries in which the contains or containsPrefix operator is used. This is attribute-based boosting. For value-based boosting, see the “boost” subquery. Defaults to null (no boosting).

Remarks

If the strictSearchOperators option is set to true in Scrivito.configure, this method does not accept the contains and containsPrefix full-text search operators. Use the andFullTextOf method instead.

Returns

ObjSearch – Itself

Example

Find Page objects linking through any link or reference attribute to at least one of the images specified using an array: