Selects results where both the preceding query expression and the query parameter are true. The segment of a query that this method adds is the same as entering the following string for an Engine query: preceding query expression AND query
query and(query/data_method query)
| query | modified query |
.where(contains("foo").and(contains("bar")))
.where("foo AND bar")
Selects results where either the preceding query expression or the query parameter is true. The segment of a query that this method adds is the same as entering the following string for an Engine query: preceding query expression OR query
query or(query/data_method query)
| query | modified query |
.where(contains("foo").or(contains("bar")))
.where("foo OR bar")
Selects results where the preceding query expression exists somewhere before the query parameter. The closer the preceding query expression is to the query parameter, the higher the relevance of the result. The segment of a query that this method adds is the same as entering the following string for an Engine query: preceding query expression BEFORE query
query before(query/data_method query)
| query | modified query |
.where(contains("foo").before(contains("bar")))
.where("foo BEFORE bar")
Selects results where the preceding query expression exists within the range of the query parameter. The segment of a query that this method adds is the same as entering the following string for an Engine query: preceding query expression WITHIN query If the query parameter is an integer, the segment of a query that this method adds is the same as entering the following string for an Engine query: preceding query expression WITHIN query WORDS
query within(query/data_method/int query)
| query | modified query |
.where(contains("foo").within(contains("bar")))
.where("foo WITHIN bar")
.where(contains("foo").within(5))
.where("foo WITHIN 5 WORDS")
Selects results where the preceding query expression does not exist within the range of the query parameter. The segment of a query that this method adds is the same as entering the following string for an Engine query: preceding query expression NOTWITHIN query
query not_within(query/data_method query)
| query | modified query |
.where(contains("foo").not_within(contains("bar")))
.where("foo NOTWITHIN bar")
Selects results where the preceding query expression contains the query parameter. Queries that are constructed by using this method produce an index match, not an exact match. The segment of a query that this method adds is the same as entering the following string for an Engine query: CONTENT preceding query expression CONTAINING query
query containing(query/data_method query)
| query | modified query |
.where(field("foo").containing(contains("bar")))
.where("CONTENT foo CONTAINING bar")
Selects results where the preceding query expression does not contain the query parameter. The segment of a query that this method adds is the same as entering the following string for an Engine query: preceding query expression NOTCONTAINING query
query not_containing(query/data_method query)
| query | modified query |
.where(field("foo").not_containing(contains("bar")))
.where("foo NOTCONTAINING bar")
Selects results where the preceding query expression does not exist. The segment of a query that this method adds is the same as entering the following string for an Engine query: -( preceding query expression )
query negated
| query | modified query |
.where(field("foo").contains("bar").negated)
.where("-(foo:bar)")
Selects results where the preceding query expression and the query parameter are within 32 words of each other. This method is equivalent to using the within method and an integer parameter of 32. The segment of a query that this method adds is the same as entering the following string for an Engine query: preceding query expression NEAR query
query near(query/data_method query)
| query | modified query |
.where(contains("foo").near(contains("bar")))
.where("foo NEAR bar")
Selects results where the preceding query expression equals the weight parameter. The segment of a query that this method adds is the same as entering the following string for an Engine query: preceding query expression ^ weight
query weight(double weight)
| query | modified query |
.where(contains("foo").weight(20))
.where("foo^20.0")