PHP Класс FactualQuery

Автор: Tyler
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$fullTextSearch
$geo bool
$includeRowCount int
$keyValuePairs
$limit otherwise comma-delineated list of fieldnames
$offset int
$rowFilters Holds all row filters for this Query. Implicit top-level AND.
$selectFields string
$sorts Holds all results sorts for this Query. Example contents: "$distance:desc","name:asc","locality:asc"
$threshold misc key-value pairs added as additional parameters

Открытые методы

Метод Описание
_and ( $queries ) Used to nest AND'ed predicates.
_or ( $queries ) Used to nest OR'ed predicates.
add ( $filter ) : void Adds filter object to this Query.
addParam ( $key, $value ) Adds misc parameters to the URL query
at ( $point ) : this Adds a filter so that results can only be obtained at a specified point
field ( $field ) : obj Begins construction of a new row filter for this Query.
getResponseType ( )
getSelectFields ( ) : array
includeRowCount ( ) : this The response will include a count of the total number of rows in the table that conform to the request based on included filters. There is a performance hit.
limit ( $limit ) : this Sets the maximum amount of records to return from this Query.
offset ( $offset ) : obj Sets how many records in to start getting results (i.e., the page offset) for this Query.
only ( $fields ) : this Sets the fields to select. This is optional; default behaviour is generally to select all fields in the schema.
search ( $term ) : obj Sets a full text search query. Factual will use this value to perform a full text search against various attributes of the underlying table, such as entity name, address, etc.
select ( $fields ) : this Sets the fields to select. This is optional; default behaviour is generally to select all fields in the schema.
setIncludeRowCount ( boolean $includeRowCount ) : this When true, the response will include a count of the total number of rows in the table that conform to the request based on included filters.
sortAsc ( $field ) : obj Sets this Query to sort field in ascending order.
sortDesc ( $field ) : this Sets this Query to sort field in descending order.
threshold ( $threshold )
toString ( )
toUrlQuery ( ) : string Builds and returns the query string to represent this Query when talking to Factual's API. Provides proper URL encoding and escaping.
within ( $geo ) : this Adds a filter so that results can only be (roughly) within the specified geometry.

Защищенные методы

Метод Описание
fieldsJsonOrNull ( )
geoBoundsJsonOrNull ( )
popFilters ( $op, array $queries ) : obj Pops the newest Filter from each of queries, grouping each popped Filter into one new FilterGroup.
rowFiltersJsonOrNull ( )
sortsJsonOrNull ( )
thresholdOrNull ( )

Описание методов

_and() публичный Метод

Used to nest AND'ed predicates.
public _and ( $queries )

_or() публичный Метод

Used to nest OR'ed predicates.
public _or ( $queries )

add() публичный Метод

Adds filter object to this Query.
public add ( $filter ) : void
Результат void

addParam() публичный Метод

Adds misc parameters to the URL query
public addParam ( $key, $value )

at() публичный Метод

Adds a filter so that results can only be obtained at a specified point
public at ( $point ) : this
Результат this Query.

field() публичный Метод

Begins construction of a new row filter for this Query.
public field ( $field ) : obj
Результат obj QueryBuilder A partial representation of the new row filter.

fieldsJsonOrNull() защищенный Метод

protected fieldsJsonOrNull ( )

geoBoundsJsonOrNull() защищенный Метод

protected geoBoundsJsonOrNull ( )

getResponseType() публичный Метод

public getResponseType ( )

getSelectFields() публичный Метод

public getSelectFields ( ) : array
Результат array of select fields set by select(), null if none.

includeRowCount() публичный Метод

The default behavior is to NOT include a row count.
public includeRowCount ( ) : this
Результат this Query, marked to return total row count when run.

limit() публичный Метод

Sets the maximum amount of records to return from this Query.
public limit ( $limit ) : this
Результат this Query

offset() публичный Метод

Sets how many records in to start getting results (i.e., the page offset) for this Query.
public offset ( $offset ) : obj
Результат obj this Query

only() публичный Метод

Sets the fields to select. This is optional; default behaviour is generally to select all fields in the schema.
Устаревший: 1.5.0 - Jul 30, 2012 Use FactualQuery::select();
public only ( $fields ) : this
Результат this Query

popFilters() защищенный Метод

Adds that new FilterGroup as the newest Filter in this Query.

The FilterGroup's logic will be determined by op.

protected popFilters ( $op, array $queries ) : obj
$queries array
Результат obj queries Query object

rowFiltersJsonOrNull() защищенный Метод

protected rowFiltersJsonOrNull ( )

select() публичный Метод

Sets the fields to select. This is optional; default behaviour is generally to select all fields in the schema.
public select ( $fields ) : this
Результат this Query

setIncludeRowCount() публичный Метод

Requesting the row count will increase the time required to return a response. The default behavior is to NOT include a row count.
public setIncludeRowCount ( boolean $includeRowCount ) : this
$includeRowCount boolean
Результат this Query.

sortAsc() публичный Метод

Sets this Query to sort field in ascending order.
public sortAsc ( $field ) : obj
Результат obj this Query

sortDesc() публичный Метод

Sets this Query to sort field in descending order.
public sortDesc ( $field ) : this
Результат this Query

sortsJsonOrNull() защищенный Метод

protected sortsJsonOrNull ( )

threshold() публичный Метод

public threshold ( $threshold )

thresholdOrNull() защищенный Метод

protected thresholdOrNull ( )

toString() публичный Метод

public toString ( )

toUrlQuery() публичный Метод

Example output:

filters=%7B%22%24and%22%3A%5B%7B%22region%22%3A%7B%22%24in%22%3A%22MA%2CVT%2CNH%22%7D%7D%2C%7B%22%24or%22%3A%5B%7B%22first_name%22%3A%7B%22%24eq%22%3A%22Chun%22%7D%7D%2C%7B%22last_name%22%3A%7B%22%24eq%22%3A%22Kok%22%7D%7D%5D%7D%5D%7D

(After decoding, the above example would be used by the server as:)

filters={"$and":[{"region":{"$in":"MA,VT,NH"}},{"$or":[{"first_name":{"$eq":"Chun"}},{"last_name":{"$eq":"Kok"}}]}]}
public toUrlQuery ( ) : string
Результат string The query string to represent this Query when talking to Factual's API.

within() публичный Метод

Adds a filter so that results can only be (roughly) within the specified geometry.
public within ( $geo ) : this
Результат this Query.

Описание свойств

$fullTextSearch защищенное свойство

protected $fullTextSearch

$geo защищенное свойство

bool
protected $geo

$includeRowCount защищенное свойство

int
protected $includeRowCount

$keyValuePairs защищенное свойство

protected $keyValuePairs

$limit защищенное свойство

otherwise comma-delineated list of fieldnames
protected $limit

$offset защищенное свойство

int
protected $offset

$rowFilters защищенное свойство

Holds all row filters for this Query. Implicit top-level AND.
protected $rowFilters

$selectFields защищенное свойство

string
protected $selectFields

$sorts защищенное свойство

Holds all results sorts for this Query. Example contents: "$distance:desc","name:asc","locality:asc"
protected $sorts

$threshold защищенное свойство

misc key-value pairs added as additional parameters
protected $threshold