PHP Класс Elastica\Document

Автор: Nicolas Ruflin ([email protected])
Наследование: extends AbstractUpdateAction
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$_autoPopulate boolean
$_data Document data.
$_docAsUpsert boolean Whether to use this document to upsert if the document does not exist.

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

Метод Описание
__construct ( integer | string $id = '', array | string $data = [], Type | string $type = '', Index | string $index = '' ) Creates a new document.
__get ( string $key ) : mixed
__isset ( string $key ) : boolean
__set ( string $key, mixed $value )
__unset ( string $key )
addFile ( string $key, string $filepath, string $mimeType = '' ) Adds a file to the index.
addFileContent ( string $key, string $content ) Add file content.
addGeoPoint ( string $key, float $latitude, float $longitude ) Adds a geopoint to the document.
create ( array | Document $data ) : self
get ( string $key ) : mixed
getData ( ) : array | string Returns the document data.
getDocAsUpsert ( ) : boolean
has ( string $key ) : boolean
isAutoPopulate ( ) : boolean
remove ( string $key )
set ( string $key, mixed $value )
setAutoPopulate ( boolean $autoPopulate = true )
setData ( array | string $data ) Overwrites the current document data with the given data.
setDocAsUpsert ( boolean $value )
toArray ( ) : array Returns the document as an array.

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

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

Creates a new document.
public __construct ( integer | string $id = '', array | string $data = [], Type | string $type = '', Index | string $index = '' )
$id integer | string OPTIONAL $id Id is create if empty
$data array | string OPTIONAL Data array
$type Type | string OPTIONAL Type name
$index Index | string OPTIONAL Index name

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

public __get ( string $key ) : mixed
$key string
Результат mixed

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

public __isset ( string $key ) : boolean
$key string
Результат boolean

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

public __set ( string $key, mixed $value )
$key string
$value mixed

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

public __unset ( string $key )
$key string

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

To use this feature you have to call the following command in the elasticsearch directory: ./bin/plugin -install elasticsearch/elasticsearch-mapper-attachments/1.6.0 This installs the tika file analysis plugin. More infos about supported formats can be found here: {@link http://tika.apache.org/0.7/formats.html}
public addFile ( string $key, string $filepath, string $mimeType = '' )
$key string Key to add the file to
$filepath string Path to add the file
$mimeType string OPTIONAL Header mime type

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

Add file content.
public addFileContent ( string $key, string $content )
$key string Document key
$content string Raw file content

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

Geohashes are not yet supported
public addGeoPoint ( string $key, float $latitude, float $longitude )
$key string Field key
$latitude float Latitude value
$longitude float Longitude value

create() публичный статический Метод

public static create ( array | Document $data ) : self
$data array | Document
Результат self

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

public get ( string $key ) : mixed
$key string
Результат mixed

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

Returns the document data.
public getData ( ) : array | string
Результат array | string Document data

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

public getDocAsUpsert ( ) : boolean
Результат boolean

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

public has ( string $key ) : boolean
$key string
Результат boolean

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

public isAutoPopulate ( ) : boolean
Результат boolean

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

public remove ( string $key )
$key string

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

public set ( string $key, mixed $value )
$key string
$value mixed

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

public setAutoPopulate ( boolean $autoPopulate = true )
$autoPopulate boolean

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

Overwrites the current document data with the given data.
public setData ( array | string $data )
$data array | string Data array

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

public setDocAsUpsert ( boolean $value )
$value boolean

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

Returns the document as an array.
public toArray ( ) : array
Результат array

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

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

protected bool $_autoPopulate
Результат boolean

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

Document data.
protected $_data

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

Whether to use this document to upsert if the document does not exist.
protected bool $_docAsUpsert
Результат boolean