idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
47,300 | public function children ( ) { $ p = $ this -> _children ( ) ; return $ p ? new self ( $ this -> doc , $ p ) : null ; } | Get child nodes for this collection of nodes . |
47,301 | public function previousElementSibling ( ) { $ p = $ this -> _prev ( ) ; return $ p ? new self ( $ this -> doc , $ p ) : null ; } | Get previous element siblings for each of the elements of this collection |
47,302 | public function nextElementSibling ( ) { $ p = $ this -> _next ( ) ; return $ p ? new self ( $ this -> doc , $ p ) : null ; } | Get next element siblings for each of the elements of this collection |
47,303 | protected function _index_comments_html ( $ o ) { if ( ! isset ( $ o -> l ) ) { $ o -> l = strlen ( $ o -> h ) ; } $ o -> tg = self :: $ _ar_ ; $ i = $ o -> i ; while ( $ i < $ o -> l ) { $ i = strpos ( $ o -> h , '<!--' , $ i ) ; if ( false === $ i ) { break ; } $ p = $ i ; $ i += 4 ; $ i = strpos ( $ o -> h , ' , $ i... | Index comment tags position in source HTML |
47,304 | private function _index_tags ( ) { $ s = $ nix = $ ix = self :: $ _ar_ ; $ ids = $ this -> ids ; foreach ( $ this -> tags as $ id => $ n ) { $ ix [ $ n ] [ $ id ] = $ ids [ $ id ] ; } foreach ( $ ix as $ n => $ v ) { foreach ( $ v as $ id => $ e ) { $ this -> tags [ $ id ] = $ n ; } if ( isset ( $ nix [ $ n ] ) ) { con... | index all tags by tagname at ids |
47,305 | private function _index_classes ( ) { $ ix = array ( ) ; $ aix = $ this -> attr_idx ; foreach ( $ this -> attribs as $ aid => & $ a ) { if ( ! empty ( $ a [ 'class' ] ) ) { $ cl = $ a [ 'class' ] ; if ( ! is_array ( $ cl ) ) { $ cl = preg_split ( '|\\s+|' , trim ( $ cl ) ) ; } foreach ( $ cl as $ cl ) { if ( isset ( $ ... | index all classes by class - name at aids |
47,306 | public static function fromHTML ( $ html , $ url = null ) { if ( $ html instanceof MessageInterface ) { $ message = $ html ; $ html = $ message -> getBody ( ) . '' ; if ( ! isset ( $ url ) && $ message instanceof RequestInterface ) { $ url = $ message -> getUri ( ) . '' ; } } $ index_time = microtime ( true ) ; if ( is... | Parse an HTML string . |
47,307 | public static function fromFile ( $ filename , $ use_include_path = false , $ context = null ) { $ read_time = microtime ( true ) ; $ html = file_get_contents ( $ filename , $ use_include_path , $ context ) ; $ read_time = microtime ( true ) - $ read_time ; if ( false === $ html ) { return $ html ; } $ doc = self :: fr... | Read the HTML document from a file . |
47,308 | protected static function get_cache ( $ fn , $ expire = false , $ meta_only = false ) { $ meta = $ cnt = null ; if ( file_exists ( $ fn ) and $ fm = filemtime ( $ fn ) and ( ! $ expire || $ fm + $ expire > time ( ) ) ) { $ cnt = self :: flock_get_contents ( $ fn ) ; } $ t = strlen ( $ cnt ) ; if ( ! empty ( $ cnt ) ) {... | Read data from a cache file . |
47,309 | protected static function set_cache ( $ fn , $ cnt , $ meta = null , $ gzip = true ) { if ( false === $ cnt ) { return ! file_exists ( $ fn ) || unlink ( $ fn ) ; } $ n = 0 ; if ( isset ( $ meta ) ) { $ meta = self :: jsonize ( $ meta ) ; $ n += strlen ( $ meta ) ; } $ meta = '#' . $ n . "\n" . $ meta ; if ( ! is_strin... | Save data to a cache file . |
47,310 | public static function do_flock ( $ fp , $ lock , $ timeout_ms = 384 ) { $ l = flock ( $ fp , $ lock ) ; if ( ! $ l && ( $ lock & LOCK_UN ) != LOCK_UN ) { $ st = microtime ( true ) ; $ m = min ( 1e3 , $ timeout_ms * 1e3 ) ; $ n = min ( 64e3 , $ timeout_ms * 1e3 ) ; if ( $ m == $ n ) { $ m = ( $ n >> 1 ) + 1 ; } $ timeo... | Lock with retries |
47,311 | private function writeMapping ( $ model ) { $ path = $ this -> getMappingPath ( ) ; $ file = pathinfo ( $ this -> creator -> create ( $ model , $ path ) , PATHINFO_FILENAME ) ; $ this -> comment ( $ file . ' was created successfully' ) ; } | Create the mapping file . |
47,312 | public function compileCreate ( Blueprint $ blueprint , Fluent $ command ) { $ fields = $ blueprint -> getFields ( ) ; $ statement = $ this -> compileFields ( $ fields ) ; return $ statement ; } | Create a map body . |
47,313 | public function compileBinary ( Fluent $ fluent ) { $ map = [ 'type' => 'binary' , 'doc_values' => $ fluent -> doc_values , 'store' => $ fluent -> store , ] ; return $ this -> formatMap ( $ map ) ; } | Compile a binary map . |
47,314 | public function compileDate ( Fluent $ fluent ) { $ map = [ 'type' => 'date' , 'boost' => $ fluent -> boost , 'doc_values' => $ fluent -> doc_values , 'format' => $ fluent -> format , 'ignore_malformed' => $ fluent -> ignore_malformed , 'include_in_all' => $ fluent -> include_in_all , 'index' => $ fluent -> index , 'nu... | Compile a date map . |
47,315 | public function compileBoolean ( Fluent $ fluent ) { $ map = [ 'type' => 'boolean' , 'boost' => $ fluent -> boost , 'doc_values' => $ fluent -> doc_values , 'index' => $ fluent -> index , 'null_value' => $ fluent -> null_value , 'store' => $ fluent -> store , ] ; return $ this -> formatMap ( $ map ) ; } | Compile a boolean map . |
47,316 | public function compilePoint ( Fluent $ fluent ) { $ map = [ 'type' => 'geo_point' , 'geohash' => $ fluent -> geohash , 'geohash_precision' => $ fluent -> geohash_precision , 'geohash_prefix' => $ fluent -> geohash_prefix , 'ignore_malformed' => $ fluent -> ignore_malformed , 'lat_lon' => $ fluent -> lat_lon , 'precisi... | Compile a geo point map . |
47,317 | public function compileShape ( Fluent $ fluent ) { $ map = [ 'type' => 'geo_shape' , 'tree' => $ fluent -> tree , 'precision' => $ fluent -> precision , 'tree_levels' => $ fluent -> tree_levels , 'strategy' => $ fluent -> strategy , 'distance_error_pct' => $ fluent -> distance_error_pct , 'orientation' => $ fluent -> o... | Compile a geo shape map . |
47,318 | public function compileIp ( Fluent $ fluent ) { $ map = [ 'type' => $ fluent -> type , 'boost' => $ fluent -> boost , 'doc_values' => $ fluent -> doc_values , 'include_in_all' => $ fluent -> include_in_all , 'index' => $ fluent -> index , 'null_value' => $ fluent -> null_value , 'precision_step' => $ fluent -> precisio... | Compile an ip map . |
47,319 | public function compileCompletion ( Fluent $ fluent ) { $ map = [ 'type' => 'completion' , 'analyzer' => $ fluent -> analyzer , 'search_analyzer' => $ fluent -> search_analyzer , 'payloads' => $ fluent -> payloads , 'preserve_separators' => $ fluent -> preserve_separators , 'max_input_length' => $ fluent -> max_input_l... | Compile a completion map . |
47,320 | public function compileString ( Fluent $ fluent ) { $ map = [ 'type' => 'string' , 'analyzer' => $ fluent -> analyzer , 'boost' => $ fluent -> boost , 'doc_values' => $ fluent -> doc_values , 'fielddata' => $ fluent -> fielddata , 'fields' => $ fluent -> fields , 'ignore_above' => $ fluent -> ignore_above , 'include_in... | Compile a string map . |
47,321 | public function compileNumeric ( Fluent $ fluent ) { $ map = [ 'type' => $ fluent -> type , 'coerce' => $ fluent -> coerce , 'boost' => $ fluent -> boost , 'doc_values' => $ fluent -> doc_values , 'ignore_malformed' => $ fluent -> ignore_malformed , 'include_in_all' => $ fluent -> include_in_all , 'index' => $ fluent -... | Compile a numeric map . |
47,322 | public function compileObject ( Fluent $ fluent ) { $ blueprint = new Blueprint ( $ fluent -> type ) ; $ callback = $ fluent -> callback ; if ( is_callable ( $ callback ) ) { $ callback ( $ blueprint ) ; } return [ 'properties' => $ this -> compileFields ( $ blueprint -> getFields ( ) ) , ] ; } | Compile a object map . |
47,323 | public function compileFields ( $ fields ) { $ statement = [ ] ; foreach ( $ fields as $ field ) { $ method = 'compile' . ucfirst ( $ field -> type ) ; if ( method_exists ( $ this , $ method ) ) { if ( ! empty ( $ map = $ this -> $ method ( $ field ) ) ) { $ statement [ $ field -> name ] = $ map ; } } } return $ statem... | Compile an array of fluent fields . |
47,324 | private function buildClient ( array $ config ) { $ client = ClientBuilder :: create ( ) -> setHosts ( $ config [ 'hosts' ] ) ; if ( isset ( $ config [ 'retries' ] ) ) { $ client -> setRetries ( $ config [ 'retries' ] ) ; } if ( isset ( $ config [ 'logging' ] ) and $ config [ 'logging' ] [ 'enabled' ] == true ) { $ log... | Create an elastic search instance . |
47,325 | public static function bootSearchable ( ) { static :: saved ( function ( $ model ) { if ( $ model -> shouldSyncDocument ( ) ) { $ model -> document ( ) -> save ( ) ; } } ) ; static :: deleted ( function ( $ model ) { if ( $ model -> shouldSyncDocument ( ) ) { $ model -> document ( ) -> delete ( ) ; } } ) ; } | Searchable boot model . |
47,326 | public function getDocumentType ( ) { if ( isset ( $ this -> documentType ) and ! empty ( $ this -> documentType ) ) { return $ this -> documentType ; } return $ this -> getTable ( ) ; } | Get the model elastic type . |
47,327 | public function getDocumentData ( ) { if ( method_exists ( $ this , 'buildDocument' ) ) { $ document = $ this -> buildDocument ( ) ; return $ document ; } elseif ( is_array ( $ this -> searchable ) ) { $ document = $ this -> buildDocumentFromArray ( $ this -> searchable ) ; return $ document ; } else { $ document = $ t... | Build the document data with the appropriate method . |
47,328 | protected function buildDocumentFromArray ( array $ searchable ) { $ document = [ ] ; foreach ( $ searchable as $ value ) { $ result = $ this -> $ value ; if ( $ result instanceof Collection ) { $ result = $ result -> toArray ( ) ; } elseif ( $ result instanceof Carbon ) { $ result = $ result -> toDateTimeString ( ) ; ... | Build the document from a searchable array . |
47,329 | public function create ( $ type , Closure $ callback , $ index = null ) { if ( ! is_string ( $ type ) ) { throw new InvalidArgumentException ( 'type should be a string' ) ; } if ( $ index and ! is_string ( $ index ) ) { throw new InvalidArgumentException ( 'index should be a string' ) ; } $ blueprint = $ this -> create... | Create a map on your elasticsearch index . |
47,330 | public function model ( Model $ model ) { $ traits = class_uses_recursive ( get_class ( $ model ) ) ; if ( ! isset ( $ traits [ Searchable :: class ] ) ) { throw new InvalidArgumentException ( get_class ( $ model ) . ' does not use the searchable trait' ) ; } $ this -> type ( $ model -> getDocumentType ( ) ) ; if ( $ i... | Set the eloquent model to use when querying elastic search . |
47,331 | public function sortBy ( $ fields , $ order = null , array $ parameters = [ ] ) { $ fields = is_array ( $ fields ) ? $ fields : [ $ fields ] ; foreach ( $ fields as $ field ) { $ sort = new FieldSort ( $ field , $ order , $ parameters ) ; $ this -> query -> addSort ( $ sort ) ; } return $ this ; } | Set the query sort values values . |
47,332 | public function ids ( $ ids ) { $ ids = is_array ( $ ids ) ? $ ids : [ $ ids ] ; $ query = new IdsQuery ( $ ids ) ; $ this -> append ( $ query ) ; return $ this ; } | Add an ids query . |
47,333 | public function term ( $ field , $ term , array $ attributes = [ ] ) { $ query = new TermQuery ( $ field , $ term , $ attributes ) ; $ this -> append ( $ query ) ; return $ this ; } | Add an term query . |
47,334 | public function terms ( $ field , array $ terms , array $ attributes = [ ] ) { $ query = new TermsQuery ( $ field , $ terms , $ attributes ) ; $ this -> append ( $ query ) ; return $ this ; } | Add an terms query . |
47,335 | public function exists ( $ fields ) { $ fields = is_array ( $ fields ) ? $ fields : [ $ fields ] ; foreach ( $ fields as $ field ) { $ query = new ExistsQuery ( $ field ) ; $ this -> append ( $ query ) ; } return $ this ; } | Add an exists query . |
47,336 | public function wildcard ( $ field , $ value , $ boost = 1.0 ) { $ query = new WildcardQuery ( $ field , $ value , [ 'boost' => $ boost ] ) ; $ this -> append ( $ query ) ; return $ this ; } | Add a wildcard query . |
47,337 | public function match ( $ field , $ term , array $ attributes = [ ] ) { $ query = new MatchQuery ( $ field , $ term , $ attributes ) ; $ this -> append ( $ query ) ; return $ this ; } | Add a match query . |
47,338 | public function multiMatch ( array $ fields , $ term , array $ attributes = [ ] ) { $ query = new MultiMatchQuery ( $ fields , $ term , $ attributes ) ; $ this -> append ( $ query ) ; return $ this ; } | Add a multi match query . |
47,339 | public function geoBoundingBox ( $ field , $ values , array $ parameters = [ ] ) { $ query = new GeoBoundingBoxQuery ( $ field , $ values , $ parameters ) ; $ this -> append ( $ query ) ; return $ this ; } | Add a geo bounding box query . |
47,340 | public function geoDistance ( $ field , $ distance , $ location , array $ attributes = [ ] ) { $ query = new GeoDistanceQuery ( $ field , $ distance , $ location , $ attributes ) ; $ this -> append ( $ query ) ; return $ this ; } | Add a geo distance query . |
47,341 | public function geoDistanceRange ( $ field , $ from , $ to , array $ location , array $ attributes = [ ] ) { $ range = compact ( 'from' , 'to' ) ; $ query = new GeoDistanceRangeQuery ( $ field , $ range , $ location , $ attributes ) ; $ this -> append ( $ query ) ; return $ this ; } | Add a geo distance range query . |
47,342 | public function geoPolygon ( $ field , array $ points = [ ] , array $ attributes = [ ] ) { $ query = new GeoPolygonQuery ( $ field , $ points , $ attributes ) ; $ this -> append ( $ query ) ; return $ this ; } | Add a geo polygon query . |
47,343 | public function geoShape ( $ field , $ type , array $ coordinates = [ ] , array $ attributes = [ ] ) { $ query = new GeoShapeQuery ( ) ; $ query -> addShape ( $ field , $ type , $ coordinates , $ attributes ) ; $ this -> append ( $ query ) ; return $ this ; } | Add a geo shape query . |
47,344 | public function prefix ( $ field , $ term , array $ attributes = [ ] ) { $ query = new PrefixQuery ( $ field , $ term , $ attributes ) ; $ this -> append ( $ query ) ; return $ this ; } | Add a prefix query . |
47,345 | public function queryString ( $ query , array $ attributes = [ ] ) { $ query = new QueryStringQuery ( $ query , $ attributes ) ; $ this -> append ( $ query ) ; return $ this ; } | Add a query string query . |
47,346 | public function simpleQueryString ( $ query , array $ attributes = [ ] ) { $ query = new SimpleQueryStringQuery ( $ query , $ attributes ) ; $ this -> append ( $ query ) ; return $ this ; } | Add a simple query string query . |
47,347 | public function highlight ( $ fields = [ '_all' => [ ] ] , $ parameters = [ ] , $ preTag = '<mark>' , $ postTag = '</mark>' ) { $ highlight = new Highlight ( ) ; $ highlight -> setTags ( [ $ preTag ] , [ $ postTag ] ) ; foreach ( $ fields as $ field => $ fieldParams ) { $ highlight -> addField ( $ field , $ fieldParams... | Add a highlight to result . |
47,348 | public function range ( $ field , array $ attributes = [ ] ) { $ query = new RangeQuery ( $ field , $ attributes ) ; $ this -> append ( $ query ) ; return $ this ; } | Add a range query . |
47,349 | public function regexp ( $ field , $ regex , array $ attributes = [ ] ) { $ query = new RegexpQuery ( $ field , $ regex , $ attributes ) ; $ this -> append ( $ query ) ; return $ this ; } | Add a regexp query . |
47,350 | public function commonTerm ( $ field , $ term , array $ attributes = [ ] ) { $ query = new CommonTermsQuery ( $ field , $ term , $ attributes ) ; $ this -> append ( $ query ) ; return $ this ; } | Add a common term query . |
47,351 | public function fuzzy ( $ field , $ term , array $ attributes = [ ] ) { $ query = new FuzzyQuery ( $ field , $ term , $ attributes ) ; $ this -> append ( $ query ) ; return $ this ; } | Add a fuzzy query . |
47,352 | public function nested ( $ field , \ Closure $ closure , $ score_mode = 'avg' ) { $ builder = new self ( $ this -> connection , new $ this -> query ( ) ) ; $ closure ( $ builder ) ; $ nestedQuery = $ builder -> query -> getQueries ( ) ; $ query = new NestedQuery ( $ field , $ nestedQuery , [ 'score_mode' => $ score_mod... | Add a nested query . |
47,353 | public function aggregate ( \ Closure $ closure ) { $ builder = new AggregationBuilder ( $ this -> query ) ; $ closure ( $ builder ) ; return $ this ; } | Add aggregation . |
47,354 | public function functions ( \ Closure $ search , \ Closure $ closure , $ parameters = [ ] ) { $ builder = new self ( $ this -> connection , new $ this -> query ( ) ) ; $ search ( $ builder ) ; $ builder = new FunctionScoreBuilder ( $ builder , $ parameters ) ; $ closure ( $ builder ) ; $ this -> append ( $ builder -> g... | Add function score . |
47,355 | public function getRaw ( ) { $ params = [ 'index' => $ this -> getIndex ( ) , 'type' => $ this -> getType ( ) , 'body' => $ this -> toDSL ( ) , ] ; return $ this -> connection -> searchStatement ( $ params ) ; } | Execute the search query against elastic and return the raw result . |
47,356 | public function get ( ) { $ result = $ this -> getRaw ( ) ; $ result = new PlasticResult ( $ result ) ; if ( $ this -> model ) { $ this -> getModelFiller ( ) -> fill ( $ this -> model , $ result ) ; } return $ result ; } | Execute the search query against elastic and return the raw result if the model is not set . |
47,357 | public function paginate ( $ limit = 25 , $ current = null ) { $ page = $ this -> getCurrentPage ( $ current ) ; $ from = $ limit * ( $ page - 1 ) ; $ size = $ limit ; $ result = $ this -> from ( $ from ) -> size ( $ size ) -> get ( ) ; return new PlasticPaginator ( $ result , $ size , $ page ) ; } | Paginate result hits . |
47,358 | public function connection ( ) { if ( ! $ this -> connection ) { $ config = $ this -> app [ 'config' ] [ 'plastic' ] ; $ this -> connection = new Connection ( $ config ) ; } return $ this -> connection ; } | Get an elastic search connection instance . |
47,359 | public function model ( Model $ model ) { $ traits = class_uses_recursive ( get_class ( $ model ) ) ; if ( ! isset ( $ traits [ Searchable :: class ] ) ) { throw new InvalidArgumentException ( get_class ( $ model ) . ' does not use the searchable trait' ) ; } $ this -> model = $ model ; return $ this ; } | Set the model to persist . |
47,360 | public function save ( ) { $ this -> exitIfModelNotSet ( ) ; if ( ! $ this -> model -> exists ) { throw new \ Exception ( 'Model not persisted yet' ) ; } $ document = $ this -> model -> getDocumentData ( ) ; $ params = [ 'id' => $ this -> model -> getKey ( ) , 'type' => $ this -> model -> getDocumentType ( ) , 'index' ... | Save a model instance . |
47,361 | public function update ( ) { $ this -> exitIfModelNotSet ( ) ; if ( ! $ this -> model -> exists ) { throw new \ Exception ( 'Model not persisted yet' ) ; } $ document = $ this -> model -> getDocumentData ( ) ; $ params = [ 'id' => $ this -> model -> getKey ( ) , 'type' => $ this -> model -> getDocumentType ( ) , 'index... | Update a model document . |
47,362 | public function delete ( ) { $ this -> exitIfModelNotSet ( ) ; $ params = [ 'id' => $ this -> model -> getKey ( ) , 'type' => $ this -> model -> getDocumentType ( ) , 'index' => $ this -> model -> getDocumentIndex ( ) , ] ; if ( $ this -> connection -> existsStatement ( $ params ) ) { return $ this -> connection -> del... | Delete a model document . |
47,363 | public function bulkSave ( $ collection = [ ] ) { $ params = [ ] ; $ defaultIndex = $ this -> connection -> getDefaultIndex ( ) ; foreach ( $ collection as $ item ) { $ modelIndex = $ item -> getDocumentIndex ( ) ; $ params [ 'body' ] [ ] = [ 'index' => [ '_id' => $ item -> getKey ( ) , '_type' => $ item -> getDocument... | Bulk save a collection Models . |
47,364 | public function create ( $ model , $ path ) { $ path = $ this -> getPath ( $ model , $ path ) ; $ stub = $ this -> getStub ( ) ; $ this -> files -> put ( $ path , $ this -> populateStub ( $ model , $ stub ) ) ; $ this -> firePostCreateHooks ( ) ; return $ path ; } | Create a mapping file . |
47,365 | protected function populateStub ( $ model , $ stub ) { $ stub = str_replace ( 'DummyClass' , $ this -> getClassName ( $ model ) , $ stub ) ; $ stub = str_replace ( 'DummyModel' , $ model , $ stub ) ; return $ stub ; } | Populate the place - holders in the mapping stub . |
47,366 | protected function getPath ( $ model , $ path ) { $ name = Str :: lower ( str_replace ( '\\' , '_' , $ model ) ) ; return $ path . '/' . $ name . '.php' ; } | Get the full path name to the mapping . |
47,367 | public function addField ( $ type , $ name , array $ attributes = [ ] ) { $ attributes = array_merge ( compact ( 'type' , 'name' ) , $ attributes ) ; $ this -> fields [ ] = $ field = new Fluent ( $ attributes ) ; return $ field ; } | Add a new field to the blueprint . |
47,368 | public function toDSL ( Grammar $ grammar ) { $ statements = [ ] ; foreach ( $ this -> commands as $ command ) { $ method = 'compile' . ucfirst ( $ command -> name ) ; if ( method_exists ( $ grammar , $ method ) ) { if ( ! is_null ( $ dsl = $ grammar -> $ method ( $ this , $ command ) ) ) { $ statements = array_merge (... | Get the raw DSL statements for the blueprint . |
47,369 | public function completion ( $ name , $ text , $ field = 'suggest' , $ parameters = [ ] ) { $ suggestion = new Suggest ( $ name , 'completion' , $ text , $ field , $ parameters ) ; $ this -> append ( $ suggestion ) ; return $ this ; } | Add a completion suggestion . |
47,370 | protected function registerManager ( ) { $ this -> app -> singleton ( 'plastic' , function ( $ app ) { return new PlasticManager ( $ app ) ; } ) ; $ this -> app -> singleton ( 'plastic.connection' , function ( $ app ) { return $ app [ 'plastic' ] -> connection ( ) ; } ) ; } | Register plastic s Manager and connection . |
47,371 | public function fill ( Model $ model , Result $ result ) { $ hits = $ result -> hits ( ) -> map ( function ( $ hit ) use ( $ model ) { return $ this -> fillModel ( $ model , $ hit ) ; } ) ; $ result -> setHits ( $ hits ) ; } | Fill the results hists into Model . |
47,372 | public function newFromBuilderRecursive ( Model $ model , array $ attributes = [ ] , Relation $ parentRelation = null ) { $ instance = $ model -> newInstance ( [ ] , $ exists = true ) ; $ instance -> unguard ( ) ; $ instance -> fill ( $ attributes ) ; $ instance -> reguard ( ) ; $ this -> loadRelationsAttributesRecursi... | Fill a model with form an elastic hit . |
47,373 | protected function prepareModel ( ) { if ( ! $ this -> model ) { throw new MissingArgumentException ( 'model property should be filled' ) ; } $ this -> model = new $ this -> model ( ) ; $ traits = class_uses_recursive ( get_class ( $ this -> model ) ) ; if ( ! isset ( $ traits [ Searchable :: class ] ) ) { throw new In... | Validate the given model and create a new instance . |
47,374 | protected function registerRepository ( ) { $ this -> app -> singleton ( 'mapping.repository' , function ( $ app ) { $ table = $ app [ 'config' ] [ 'plastic.mappings' ] ; return new Mappings ( $ app [ 'db' ] , $ table ) ; } ) ; } | Register the mapping repository service . |
47,375 | public function getRan ( ) { $ result = $ this -> table ( ) -> orderBy ( 'batch' , 'asc' ) -> orderBy ( 'mapping' , 'asc' ) -> pluck ( 'mapping' ) ; if ( is_array ( $ result ) ) { return $ result ; } return $ result -> toArray ( ) ; } | Get the ran mappings . |
47,376 | public function getLast ( ) { $ result = $ this -> table ( ) -> where ( 'batch' , $ this -> getLastBatchNumber ( ) ) -> orderBy ( 'mapping' , 'desc' ) -> get ( ) ; if ( is_array ( $ result ) ) { return $ result ; } return $ result -> toArray ( ) ; } | Get the last mapping batch . |
47,377 | public function createRepository ( ) { $ this -> schema ( ) -> create ( $ this -> table , function ( $ table ) { $ table -> increments ( 'id' ) ; $ table -> string ( 'mapping' ) ; $ table -> integer ( 'batch' ) ; } ) ; } | Create the mapping repository data store . |
47,378 | public function average ( $ alias , $ field = null , $ script = null ) { $ aggregation = new AvgAggregation ( $ alias , $ field , $ script ) ; $ this -> append ( $ aggregation ) ; } | Add an average aggregate . |
47,379 | public function cardinality ( $ alias , $ field = null , $ script = null , $ precision = null , $ rehash = null ) { $ aggregation = new CardinalityAggregation ( $ alias ) ; $ aggregation -> setField ( $ field ) ; $ aggregation -> setScript ( $ script ) ; $ aggregation -> setPrecisionThreshold ( $ precision ) ; $ aggreg... | Add an cardinality aggregate . |
47,380 | public function dateRange ( $ alias , $ field , $ format , array $ ranges ) { $ aggregation = new DateRangeAggregation ( $ alias , $ field , $ format , $ ranges ) ; $ this -> append ( $ aggregation ) ; } | Add a date range aggregate . |
47,381 | public function geoHashGrid ( $ alias , $ field , $ precision , $ size = null , $ shardSize = null ) { $ aggregation = new GeoHashGridAggregation ( $ alias , $ field , $ precision , $ size , $ shardSize ) ; $ this -> append ( $ aggregation ) ; } | Add a geo hash grid aggregate . |
47,382 | public function histogram ( $ alias , $ field , $ interval , $ minDocCount = null , $ orderMode = null , $ orderDirection = 'asc' , $ extendedBoundsMin = null , $ extendedBoundsMax = null , $ keyed = null ) { $ aggregation = new HistogramAggregation ( $ alias , $ field , $ interval , $ minDocCount , $ orderMode , $ ord... | Add a histogram aggregate . |
47,383 | public function ipv4Range ( $ alias , $ field , array $ ranges ) { $ aggregation = new Ipv4RangeAggregation ( $ alias , $ field , $ ranges ) ; $ this -> append ( $ aggregation ) ; } | Add an ipv4 range aggregate . |
47,384 | public function max ( $ alias , $ field = null , $ script = null ) { $ aggregation = new MaxAggregation ( $ alias , $ field , $ script ) ; $ this -> append ( $ aggregation ) ; } | Add an max aggregate . |
47,385 | public function min ( $ alias , $ field = null , $ script = null ) { $ aggregation = new MinAggregation ( $ alias , $ field , $ script ) ; $ this -> append ( $ aggregation ) ; } | Add an min aggregate . |
47,386 | public function missing ( $ alias , $ field ) { $ aggregation = new MissingAggregation ( $ alias , $ field ) ; $ this -> append ( $ aggregation ) ; } | Add an missing aggregate . |
47,387 | public function percentile ( $ alias , $ field , $ percents , $ script = null , $ compression = null ) { $ aggregation = new PercentilesAggregation ( $ alias , $ field , $ percents , $ script , $ compression ) ; $ this -> append ( $ aggregation ) ; } | Add an percentile aggregate . |
47,388 | public function percentileRanks ( $ alias , $ field , array $ values , $ script = null , $ compression = null ) { $ aggregation = new PercentileRanksAggregation ( $ alias , $ field , $ values , $ script , $ compression ) ; $ this -> append ( $ aggregation ) ; } | Add an percentileRanks aggregate . |
47,389 | public function stats ( $ alias , $ field = null , $ script = null ) { $ aggregation = new StatsAggregation ( $ alias , $ field , $ script ) ; $ this -> append ( $ aggregation ) ; } | Add an stats aggregate . |
47,390 | public function sum ( $ alias , $ field = null , $ script = null ) { $ aggregation = new SumAggregation ( $ alias , $ field , $ script ) ; $ this -> append ( $ aggregation ) ; } | Add an sum aggregate . |
47,391 | public function valueCount ( $ alias , $ field = null , $ script = null ) { $ aggregation = new ValueCountAggregation ( $ alias , $ field , $ script ) ; $ this -> append ( $ aggregation ) ; } | Add a value count aggregate . |
47,392 | public function range ( $ alias , $ field , array $ ranges , $ keyed = false ) { $ aggregation = new RangeAggregation ( $ alias , $ field , $ ranges , $ keyed ) ; $ this -> append ( $ aggregation ) ; } | Add a range aggregate . |
47,393 | public function terms ( $ alias , $ field = null , $ script = null ) { $ aggregation = new TermsAggregation ( $ alias , $ field , $ script ) ; $ this -> append ( $ aggregation ) ; } | Add a terms aggregate . |
47,394 | public function runMappingList ( array $ mappings , array $ options = [ ] ) { if ( count ( $ mappings ) == 0 ) { $ this -> note ( '<info>Nothing to map</info>' ) ; return ; } $ batch = $ this -> repository -> getNextBatchNumber ( ) ; $ step = Arr :: get ( $ options , 'step' , false ) ; $ index = Arr :: get ( $ options ... | Run an array of mappings . |
47,395 | public function runMap ( $ file , $ batch , $ index = null ) { $ mapping = $ this -> resolve ( $ file ) ; $ mapping -> setIndex ( $ index ) ; $ mapping -> map ( ) ; $ this -> repository -> log ( $ file , $ batch ) ; $ this -> note ( '<info>Mapped:</info> ' . $ file ) ; } | Run the given mapping file . |
47,396 | public function createAlias ( $ alias ) { class_alias ( 'Pixie\\AliasFacade' , $ alias ) ; $ builder = $ this -> container -> build ( '\\Pixie\\QueryBuilder\\QueryBuilderHandler' , array ( $ this ) ) ; AliasFacade :: setQueryBuilderInstance ( $ builder ) ; } | Create an easily accessible query builder alias |
47,397 | protected function connect ( ) { $ adapter = '\\Pixie\\ConnectionAdapters\\' . ucfirst ( strtolower ( $ this -> adapter ) ) ; $ adapterInstance = $ this -> container -> build ( $ adapter , array ( $ this -> container ) ) ; $ pdo = $ adapterInstance -> connect ( $ this -> adapterConfig ) ; $ this -> setPdoInstance ( $ p... | Create the connection adapter |
47,398 | public function first ( ) { $ this -> limit ( 1 ) ; $ result = $ this -> get ( ) ; return empty ( $ result ) ? null : $ result [ 0 ] ; } | Get first row |
47,399 | public function count ( ) { $ originalStatements = $ this -> statements ; unset ( $ this -> statements [ 'orderBys' ] ) ; unset ( $ this -> statements [ 'limit' ] ) ; unset ( $ this -> statements [ 'offset' ] ) ; $ count = $ this -> aggregate ( 'count' ) ; $ this -> statements = $ originalStatements ; return $ count ; ... | Get count of rows |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.