QueryHelpers


contains

Requires that string must exist in the entity. 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: string

Syntax

query contains(string string)
AppBuilder simple contains:
.where(contains("foo"))
Engine-equivalent simple contains:
.where("foo")
AppBuilder chained contains:
.where(contains("foo").before(contains("bar"))
Engine-equivalent chained contains:
.where("foo BEFORE bar")

field

Requires that the name field must exist. After you specify the field name, type a period (.) and chain additional methods to further specify the data that you want to return. Additional methods can return queries, sorts, and facets. The segment of a query that this method adds is the same as entering the following string for an Engine query: CONTENT name

Syntax

data_method field(string name)
AppBuilder simple field:
.where(field("field-name"))
Engine-equivalent simple field:
.where("CONTENT field-name")
AppBuilder chained field:
.where(field("foo").contains("bar").and(field("baz")))
Engine-equivalent chained field:
.where("CONTENT foo CONTAINING bar CONTENT baz")

words

Requires that a span of length words must exist. The segment of a query that this method adds is the same as entering the following string for an Engine query: length WORDS

Syntax

query words(int length)
AppBuilder simple word length:
.where(words(5))
Engine-equivalent simple word length:
.where("WORDS 5")
AppBuilder chained field:
.where(field("field-name").containing(words(5)))
Engine-equivalent chained field:
.where("CONTENT field-name CONTAINING 5 WORDS")

regex

Requires that regex must match text in the entity. POSIX and PCRE regular expression syntaxes are supported. The segment of a query that this method adds is the same as entering the following string for an Engine query: m/ regex /

Syntax

query regex(string regex)
AppBuilder regex:
.where(regex("fo.+"))
Engine-equivalent regex:
.where("m/fo.+/")

entity_types

Searches the specified entity types. You can specify one entity type as a string or an array of entity types as strings. The segment of a query that this method adds has no equivalent for Engine. entity_type and entity_types are aliases for each other.

Syntax

entity_types(string/array entity_types, string context)
Appbuilder entity type:
entity_types("foo")
Appbuilder entity types:
entity_types(["foo", "bar"])

entity_type

Searches the specified entity types. You can specify one entity type as a string or an array of entity types as strings. The segment of a query that this method adds has no equivalent for Engine. entity_type and entity_types are aliases for each other.

Syntax

entity_type(string/array entity_types, string context)
Appbuilder entity type:
entity_types("foo")
Appbuilder entity types:
entity_types(["foo", "bar"])

xpath

Adds an XPath expression that can be used for filtering, sorting and faceting. The segment of a query that this method adds is not exposed for Engine.

Syntax

data_method xpath(string xpath)
Appbuilder xpath:
.sorted_by(xpath("substring-after($first-and-last-name, ' ')"))

sum

Adds a faceting calculation for summation. The segment of a query that this method adds is not exposed for Engine. field can be the field method, the xpath method, or the name of a field. Example usage: faceted_by( field( "author" ).with_facet_id( "some_id" ).without_pruning.then( sum( field( "revenue" ) ) )

Syntax

facet_by sum(data_method/string field)
Appbuilder author revenue:
faceted_by(field("author").with_facet_id("some_id").without_pruning.then(sum(xpath("$revenue")))

min

Adds a faceting calculation for minimum. The segment of a query that this method adds is not exposed for Engine. field can be the field method, the xpath method, or the name of a field. Example usage: faceted_by( field( "author" ).with_facet_id( "some_id" ).without_pruning.then( min( field( "year" ) ) )

Syntax

facet_by min(data_method/string field)
Appbuilder author minimum year:
faceted_by(field("author").with_facet_id("some_id").without_pruning.then(min(xpath('$year')))

max

Adds a faceting calculation for maximum. The segment of a query that this method adds is not exposed for Engine. field can be the field method, the xpath method, or the name of a field. Example usage: faceted_by( field( "author" ).with_facet_id( "some_id" ).without_pruning.then( max( field( "year" ) ) )

Syntax

facet_by max(data_method/string field)
Appbuilder author maximum year:
faceted_by(field("author").with_facet_id("some_id").without_pruning.then(max(xpath('$year')))

avg

Adds a faceting calculation for average. The segment of a query that this method adds is not exposed for Engine. field can be the field method, the xpath method, or the name of a field. Example usage: faceted_by( field( "year" ).with_facet_id( "some_id" ).without_pruning.then( avg( field( "sales" ) ) )

Syntax

facet_by avg(data_method/string field)
Appbuilder average sales by year:
faceted_by(field("year").with_facet_id("some_id").without_pruning.then(avg(xpath('$sales')))

stddev

Adds a faceting calculation for standard deviation. The segment of a query that this method adds is not exposed for Engine. field can be the field method, the xpath method, or the name of a field. Example usage: faceted_by( field( "year" ).with_facet_id( "some_id" ).without_pruning.then( stddev( field( "sales" ) ) )

Syntax

facet_by stddev(data_method/string field)
Appbuilder standard deviation of sales by year:
faceted_by(field("year").with_facet_id("some_id").without_pruning.then(stddev(xpath('$sales')))