Builder
class Builder
Traits
Constants
MIN_QUERY_SIZE |
|
MAX_QUERY_SIZE |
|
SPECIAL_CHARS |
|
DIR_ASC |
|
DIR_DESC |
|
VALUE_TYPES |
|
REPLACEMENT_ENTITIES |
|
SORTING_DIRS |
|
OP_EQ |
|
OP_NEQ |
|
OP_LT |
|
OP_LTE |
|
OP_GT |
|
OP_GTE |
|
OP_LIKE |
|
OPERATORS |
|
Properties
protected APIClient | $connection | ||
protected array | $fields | ||
protected array | $relations | ||
protected int | $relation_id | ||
protected int | $size | ||
protected string | $orderBy | ||
protected string | $sortDir | ||
protected array | $query | ||
protected bool | $respectPublishingStatus | ||
protected Closure | $mapper | ||
protected bool | $assoc | ||
protected bool | $shouldCache | ||
protected string | $cacheKey | ||
protected bool | $debug | ||
protected callable[] | $appends | ||
protected string | $model |
Methods
No description
No description
No description
No description
No description
No description
No description
Cache the results with the given key
No description
No description
No description
No description
Compiles the field name into something ES can understand
No description
Sets the debug flag of the query Making the API reflect the compiled query in the output
Compiles the query and retrieves the query string.
Compiles the query and retrieves the query string.
Sets the field which to order the results by
Sets the direction to order the results by
Sets the relation for the query
No description
Queries where field is between $from and $to
Queries where field is not between $from and $to
Creates a paginated result
Retrieves the raw query result from the API
Retrieves the results of the query
No description
Retrieves the first result
Retrieves the first result
Retrives all results for the given query, ignoring the query limit
Returns random results for the given query
Also include unpublished results Only applies to entry and page relations
Only include published results Only applies to entry and page relations
Get the count of items matching the current query
No description
No description
No description
No description
Details
at line 153
__construct(bool|null $respectPublishingStatus = true, array|null $query = null, Closure|null $mapper = null, $appends = [])
at line 165
Builder
connection(string|null $name)
at line 174
Builder
setConnectionName(string|null $connection)
at line 180
getConnectionName()
at line 188
APIClient
getConnection()
at line 209
void
setModel(string $model)
at line 217
string|null
getModel()
at line 228
Builder
cacheResultsWithKey(string $key)
Cache the results with the given key
at line 240
protected bool
hasRelation(string $relation)
at line 250
protected mixed
escapeValue(null|array|bool|int|string|DateTimeInterface $value, string $operator = null)
at line 278
protected string
compileTermQuery(string $field, null|array|bool|int|string|DateTimeInterface $value)
at line 287
protected string
compileNullQuery(string $field)
at line 297
protected string
compileScopedQuery(array $args, string $operator = 'AND')
at line 327
protected string
compileField(string $field)
Compiles the field name into something ES can understand
at line 343
protected string
compileWhereQuery(string $field, $operator, null|array|Collection|bool|int|QueryableModel|string|DateTimeInterface $value)
at line 442
Builder
debug()
Sets the debug flag of the query Making the API reflect the compiled query in the output
at line 455
string
getQuery(bool $scoped = false)
Compiles the query and retrieves the query string.
Used for debugging purposes.
at line 467
string
getRequest()
Compiles the query and retrieves the query string.
Used for debugging purposes.
at line 478
Builder
raw(string $query)
Performs a raw query, use carefully.
at line 492
Builder
orderBy(string $field, string $direction = null)
Sets the field which to order the results by
at line 510
Builder
orderDirection(string $direction)
Sets the direction to order the results by
at line 527
Builder
relation(string|null $relation, int|null $relation_id = null)
Sets the relation for the query
at line 556
relations(array $relations)
at line 571
Builder
limit(int $limit)
Limits the results to $limit amount of hits
at line 585
Builder
fields(array $fields)
Sets which fields to retrieve (default: All fields)
at line 600
Builder
field(string $field)
Adds a field that should be retrieved
at line 619
Builder
where(...$args)
Performs a 'where' query
If a closure is passed as the only argument, a new query scope will be created. If $value is omitted, $operator is used as the $value, and the $operator will be set to '='.
at line 647
Builder
whereIn(string $field, array $values)
Queries where field exists in the values
at line 660
Builder
whereBetween(string $field, null|array|bool|int|string|DateTimeInterface $from, null|array|bool|int|string|DateTimeInterface $to)
Queries where field is between $from and $to
at line 677
Builder
whereNotBetween(string $field, null|array|bool|int|string|DateTimeInterface $from, null|array|bool|int|string|DateTimeInterface $to)
Queries where field is not between $from and $to
at line 697
Builder
whereNot(...$args)
Performs a 'whereNot' query
If a closure is passed as the only argument, a new query scope will be created. If $value is omitted, $operator is used as the $value, and the $operator will be set to '='.
at line 730
Builder
orWhere(...$args)
Performs a 'orWhere' query
If a closure is passed as the only argument, a new query scope will be created. If $value is omitted, $operator is used as the $value, and the $operator will be set to '='.
at line 752
Builder
andWhere(...$args)
Performs a 'andWhere' query
If a closure is passed as the only argument, a new query scope will be created. If $value is omitted, $operator is used as the $value, and the $operator will be set to '='.
at line 770
PaginatedResult
paginate(int $size = 100, int $page = 1)
Creates a paginated result
at line 785
Builder
assoc(bool $assoc)
Determines if we should return values as array or object
at line 799
object
fetch(int $size = null, int $page = null)
Retrieves the raw query result from the API
at line 835
Collection
get()
Retrieves the results of the query
at line 847
getMapper()
at line 856
Builder
setMapper(callable $mapper)
at line 868
object|null
first()
Retrieves the first result
at line 885
object|null
firstOrFail()
Retrieves the first result
at line 904
Collection
all()
Retrives all results for the given query, ignoring the query limit
at line 920
Collection
random(int|null $amount = null)
Returns random results for the given query
at line 972
Builder
ignorePublishingStatus()
Also include unpublished results Only applies to entry and page relations
at line 986
Builder
respectPublishingStatus($respect = true)
Only include published results Only applies to entry and page relations
at line 998
int
count()
Get the count of items matching the current query
at line 1014
publishedAt(string|DateTimeInterface|null $date)
at line 1053
protected string
compileQuery(bool $scoped = false)
at line 1077
protected string
compileRequest($size = null, $page = null)
at line 1114
Builder
if(bool|Closure $clause, Closure $then, Closure|null $else = null)
Conditional query