PHP Class Elastica\Document

Author: Nicolas Ruflin ([email protected])
Inheritance: extends AbstractUpdateAction
Afficher le fichier Open project: ruflin/elastica Class Usage Examples

Protected Properties

Свойство Type Description
$_autoPopulate boolean
$_data Document data.
$_docAsUpsert boolean Whether to use this document to upsert if the document does not exist.

Méthodes publiques

Méthode Description
__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.

Method Details

__construct() public méthode

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 méthode

public __get ( string $key ) : mixed
$key string
Résultat mixed

__isset() public méthode

public __isset ( string $key ) : boolean
$key string
Résultat boolean

__set() public méthode

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

__unset() public méthode

public __unset ( string $key )
$key string

addFile() public méthode

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() public méthode

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

addGeoPoint() public méthode

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 méthode

public static create ( array | Document $data ) : self
$data array | Document
Résultat self

get() public méthode

public get ( string $key ) : mixed
$key string
Résultat mixed

getData() public méthode

Returns the document data.
public getData ( ) : array | string
Résultat array | string Document data

getDocAsUpsert() public méthode

public getDocAsUpsert ( ) : boolean
Résultat boolean

has() public méthode

public has ( string $key ) : boolean
$key string
Résultat boolean

isAutoPopulate() public méthode

public isAutoPopulate ( ) : boolean
Résultat boolean

remove() public méthode

public remove ( string $key )
$key string

set() public méthode

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

setAutoPopulate() public méthode

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

setData() public méthode

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

setDocAsUpsert() public méthode

public setDocAsUpsert ( boolean $value )
$value boolean

toArray() public méthode

Returns the document as an array.
public toArray ( ) : array
Résultat array

Property Details

$_autoPopulate protected_oe property

protected bool $_autoPopulate
Résultat boolean

$_data protected_oe property

Document data.
protected $_data

$_docAsUpsert protected_oe property

Whether to use this document to upsert if the document does not exist.
protected bool $_docAsUpsert
Résultat boolean