PHP Трейт Elasticquent\ElasticquentTrait

Functionality extensions for Elequent that makes working with Elasticsearch easier.
Наследование: use trait elasticquent\ElasticquentClientTrait
Показать файл Открыть проект

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

Свойство Тип Описание
$documentScore null | integer Hit score when using data from Elasticsearch results.
$documentVersion null | integer Elasticsearch document version.
$isDocument boolean Set to true when our model is populated by a
$usesTimestampsInIndex boolean Uses Timestamps In Index

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

Метод Описание
addAllToIndex ( ) : array Index Documents
addToIndex ( ) : array Add to Search Index
complexSearch ( $params ) : elasticquent\ElasticquentResultCollection Perform a "complex" or custom search.
createIndex ( integer $shards = null, integer $replicas = null ) : array Create Index
deleteIndex ( ) : array Delete Index
deleteMapping ( ) : array Delete Mapping
documentScore ( ) : null | float Get Document Score
documentVersion ( ) : null | integer Document Version
dontUseTimestampsInIndex ( ) Don't Use Timestamps In Index.
getBasicEsParams ( boolean $getIdIfPossible = true, boolean $getSourceIfPossible = false, boolean $getTimestampIfPossible = false, integer $limit = null, integer $offset = null ) : array Get Basic Elasticsearch Params
getIndexDocumentData ( ) : array Get Index Document Data
getIndexSettings ( ) : array Get Index Settings
getIndexedDocument ( ) : array Get Search Document
getMapping ( ) : void Get Mapping
getMappingProperties ( ) : array Get Mapping Properties
getTypeName ( ) : string Get Type Name
hydrateElasticquentResult ( array $items, array $meta = null ) : Elasticquent\ElasticquentResultCollection Create a elacticquent result collection of models from plain arrays.
hydrateElasticsearchResult ( array $result ) : Elasticquent\ElasticquentResultCollection Create a elacticquent result collection of models from plain elasticsearch result.
hydrateRecursive ( Model $model, array $items, Illuminate\Database\Eloquent\Relations\Relation $parentRelation = null ) : Illuminate\Database\Eloquent\Collection Create a collection of models from plain arrays recursive.
isDocument ( ) : boolean Is Elasticsearch Document
loadPivotAttribute ( Model $model, Illuminate\Database\Eloquent\Relations\Relation $parentRelation = null ) Get the pivot attribute from a model.
loadRelationsAttributesRecursive ( Model $model ) Get the relations attributes from a model.
mappingExists ( ) : boolean Mapping Exists
newCollection ( array $models = [] ) : ElasticquentCollection New Collection
newElasticquentResultCollection ( array $models = [], array $meta = null ) : Elasticquent\ElasticquentResultCollection Create a new Elasticquent Result Collection instance.
newFromBuilderRecursive ( Model $model, array $attributes = [], Illuminate\Database\Eloquent\Relations\Relation $parentRelation = null ) : static Create a new model instance that is existing recursive.
newFromHitBuilder ( array $hit = [] ) : static New From Hit Builder
putMapping ( boolean $ignoreConflicts = false ) : array Put Mapping.
rebuildMapping ( ) : array Rebuild Mapping
reindex ( ) : array Re-Index All Content
removeFromIndex ( ) : array Remove From Search Index
search ( string $term = '' ) : elasticquent\ElasticquentResultCollection Search
searchByQuery ( array $query = null, array $aggregations = null, array $sourceFields = null, integer $limit = null, integer $offset = null, array $sort = null ) : elasticquent\ElasticquentResultCollection Search By Query
setMappingProperties ( array $mapping = null ) Set Mapping Properties
typeExists ( ) : boolean Type Exists.
updateIndex ( ) : array Partial Update to Indexed Document
useTimestampsInIndex ( $shouldUse = true ) Use Timestamps In Index.
usesTimestampsInIndex ( ) Uses Timestamps In Index.

Приватные методы

Метод Описание
buildFieldsParameter ( boolean $getSourceIfPossible, boolean $getTimestampIfPossible ) : array Build the 'fields' parameter depending on given options.
isMultiLevelArray ( array $array ) : boolean Check if an array is multi-level array like [[id], [id], [id]].

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

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

Index all documents in an Eloquent model.
public static addAllToIndex ( ) : array
Результат array

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

Add to Search Index
public addToIndex ( ) : array
Результат array

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

Using this method, a custom query can be sent to Elasticsearch.
public static complexSearch ( $params ) : elasticquent\ElasticquentResultCollection
$params parameters to be passed directly to Elasticsearch
Результат elasticquent\ElasticquentResultCollection

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

Create Index
public static createIndex ( integer $shards = null, integer $replicas = null ) : array
$shards integer
$replicas integer
Результат array

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

Delete Index
public static deleteIndex ( ) : array
Результат array

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

Delete Mapping
public static deleteMapping ( ) : array
Результат array

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

Get Document Score
public documentScore ( ) : null | float
Результат null | float

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

Document Version
public documentVersion ( ) : null | integer
Результат null | integer

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

Don't Use Timestamps In Index.
Устаревший:

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

Most Elasticsearch API calls need the index and type passed in a parameter array.
public getBasicEsParams ( boolean $getIdIfPossible = true, boolean $getSourceIfPossible = false, boolean $getTimestampIfPossible = false, integer $limit = null, integer $offset = null ) : array
$getIdIfPossible boolean
$getSourceIfPossible boolean
$getTimestampIfPossible boolean
$limit integer
$offset integer
Результат array

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

Get the data that Elasticsearch will index for this particular document.
public getIndexDocumentData ( ) : array
Результат array

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

Get Index Settings
public getIndexSettings ( ) : array
Результат array

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

Retrieve an ElasticSearch document for this entity.
public getIndexedDocument ( ) : array
Результат array

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

Get Mapping
public static getMapping ( ) : void
Результат void

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

Get Mapping Properties
public getMappingProperties ( ) : array
Результат array

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

Get Type Name
public getTypeName ( ) : string
Результат string

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

Create a elacticquent result collection of models from plain arrays.
public static hydrateElasticquentResult ( array $items, array $meta = null ) : Elasticquent\ElasticquentResultCollection
$items array
$meta array
Результат Elasticquent\ElasticquentResultCollection

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

Create a elacticquent result collection of models from plain elasticsearch result.
public static hydrateElasticsearchResult ( array $result ) : Elasticquent\ElasticquentResultCollection
$result array
Результат Elasticquent\ElasticquentResultCollection

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

Create a collection of models from plain arrays recursive.
public static hydrateRecursive ( Model $model, array $items, Illuminate\Database\Eloquent\Relations\Relation $parentRelation = null ) : Illuminate\Database\Eloquent\Collection
$model Illuminate\Database\Eloquent\Model
$items array
$parentRelation Illuminate\Database\Eloquent\Relations\Relation
Результат Illuminate\Database\Eloquent\Collection

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

Is the data in this module sourced from an Elasticsearch document source?
public isDocument ( ) : boolean
Результат boolean

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

Get the pivot attribute from a model.
public static loadPivotAttribute ( Model $model, Illuminate\Database\Eloquent\Relations\Relation $parentRelation = null )
$model Illuminate\Database\Eloquent\Model
$parentRelation Illuminate\Database\Eloquent\Relations\Relation

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

Get the relations attributes from a model.
public static loadRelationsAttributesRecursive ( Model $model )
$model Illuminate\Database\Eloquent\Model

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

Mapping Exists
public static mappingExists ( ) : boolean
Результат boolean

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

New Collection
public newCollection ( array $models = [] ) : ElasticquentCollection
$models array
Результат ElasticquentCollection

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

Create a new Elasticquent Result Collection instance.
public newElasticquentResultCollection ( array $models = [], array $meta = null ) : Elasticquent\ElasticquentResultCollection
$models array
$meta array
Результат Elasticquent\ElasticquentResultCollection

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

Create a new model instance that is existing recursive.
public static newFromBuilderRecursive ( Model $model, array $attributes = [], Illuminate\Database\Eloquent\Relations\Relation $parentRelation = null ) : static
$model Illuminate\Database\Eloquent\Model
$attributes array
$parentRelation Illuminate\Database\Eloquent\Relations\Relation
Результат static

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

Variation on newFromBuilder. Instead, takes
public newFromHitBuilder ( array $hit = [] ) : static
$hit array
Результат static

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

Put Mapping.
public static putMapping ( boolean $ignoreConflicts = false ) : array
$ignoreConflicts boolean
Результат array

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

This will delete and then re-add the mapping for this model.
public static rebuildMapping ( ) : array
Результат array

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

Re-Index All Content
public static reindex ( ) : array
Результат array

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

Remove From Search Index
public removeFromIndex ( ) : array
Результат array

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

Search with a query array
public static searchByQuery ( array $query = null, array $aggregations = null, array $sourceFields = null, integer $limit = null, integer $offset = null, array $sort = null ) : elasticquent\ElasticquentResultCollection
$query array
$aggregations array
$sourceFields array
$limit integer
$offset integer
$sort array
Результат elasticquent\ElasticquentResultCollection

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

Set Mapping Properties
public setMappingProperties ( array $mapping = null )
$mapping array

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

Does this type exist?
public static typeExists ( ) : boolean
Результат boolean

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

Partial Update to Indexed Document
public updateIndex ( ) : array
Результат array

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

Use Timestamps In Index.
public useTimestampsInIndex ( $shouldUse = true )

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

Uses Timestamps In Index.

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

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

Hit score when using data from Elasticsearch results.
protected null|int $documentScore
Результат null | integer

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

Elasticsearch document version.
protected null|int $documentVersion
Результат null | integer

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

Set to true when our model is populated by a
protected bool $isDocument
Результат boolean

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

Uses Timestamps In Index
protected bool $usesTimestampsInIndex
Результат boolean