Optional
q: stringAn existing query string to start building from.
Private
addPrivate
cleanupPrivate
commitPrivate
currentPrivate
formatPrivate
needsPrivate
openPrivate
qPrivate
rangePrivate
termPrivate
hasPrivate
hasJoins two sets of queries with an AND
clause.
const query = new SearchQueryBuilder()
.match("Lakes")
.in("title")
.and()
.match("Rivers")
.in("title")
Boosts the previous term to increase its rank in the results.
const query = new SearchQueryBuilder()
.match("Lakes")
.in("title")
.or()
.match("Rivers")
.in("title")
.boost(3)
Returns a new instance of SearchQueryBuilder
based on the current instance.
Ends a search group.
const query = new SearchQueryBuilder()
.startGroup()
.match("Lakes")
.in("title")
.endGroup()
.or()
.startGroup()
.match("Rivers")
.in("title")
.endGroup()
Begins a new range query.
const NEWYEARS = new Date("2020-01-01")
const TODAY = new Date()
const query = new SearchQueryBuilder()
.from(NEWYEARS)
.to(TODAY)
.in("created")
Defines fields to search in. You can pass "*"
or call this method without arguments to search a default set of fields
const query = new SearchQueryBuilder()
.match("My Layer")
.in("title")
Optional
field: stringThe field to search for the previous match in.
Defines strings to search for.
const query = new SearchQueryBuilder()
.match("My Layer")
Rest
...terms: string[]strings to search for.
Joins two sets of queries with a NOT
clause. Another option for filtering results is the prohibit operator '-'.
// omit results with "Rivers" in their title
const query = new SearchQueryBuilder()
.not()
.match("Rivers")
.in("title")
// equivalent
const query = new SearchQueryBuilder()
.match("Rivers")
.in("-title")
Joins two sets of queries with an OR
clause.
const query = new SearchQueryBuilder()
.match("Lakes")
.in("title")
.or()
.match("Rivers")
.in("title")
Starts a new search group.
const query = new SearchQueryBuilder()
.startGroup()
.match("Lakes")
.in("title")
.endGroup()
.or()
.startGroup()
.match("Rivers")
.in("title")
.endGroup()
Ends a range query.
const query = new SearchQueryBuilder()
.from(yesterdaysDate)
.to(todaysDate)
.in("created")
SearchQueryBuilder
can be used to construct theq
param forsearchItems
orsearchGroups
. By chaining methods, it helps build complex search queries.Will search for items matching