MapReduce

MapReduce

category

Basho

author

Riak team (https://github.com/basho/riak-php-client/contributors)

Methods

Construct a Map/Reduce object.

__construct(\Basho\Riak\Riak $client) : \Basho\Riak\MapReduce

Arguments

$client

\Basho\Riak\Riak

  • A Client object.

Response

\Basho\Riak\MapReduce

Add inputs to a map/reduce operation

add(mixed $arg1, mixed $arg2 = NULL, mixed $arg3 = NULL) : \Basho\Riak\MapReduce

This method takes three different forms, depending on the provided inputs. You can specify either a Object, a string bucket name, or a bucket, key, and additional arg.

Arguments

$arg1

mixed

Object or Bucket

$arg2

mixed

Key or blank

$arg3

mixed

Arg or blank

Response

\Basho\Riak\MapReduce

Add a map phase to the map/reduce operation

map(mixed $function, \Basho\Riak\array() $options = array()) : $this

Arguments

$function

mixed

  • Either a named Javascript function (ie: "Riak.mapValues"), or an anonymous javascript function (ie: "function(...) { ... }" or an array ["erlang_module", "function"].

$options

\Basho\Riak\array()

  • An optional associative array containing "language", "keep" flag, and/or "arg".

Response

$this

Add a reduce phase to the map/reduce operation

reduce(mixed $function, \Basho\Riak\array() $options = array()) : $this

Arguments

$function

mixed

  • Either a named Javascript function (ie: "Riak.mapValues"), or an anonymous javascript function (ie: "function(...) { ... }" or an array ["erlang_module", "function"].

$options

\Basho\Riak\array()

  • An optional associative array containing "language", "keep" flag, and/or "arg".

Response

$this

Add a key filter to the map/reduce operation

key_filter(array $filter) : $this

If there are already existing filters, an "and" condition will be used to combine them. Alias for key_filter_and

Arguments

$filter

array

  • a key filter (ie: ->key_filter( array("tokenize", "-", 2), array("between", "20110601", "20110630") )

Response

$this

Add a key filter to the map/reduce operation

key_filter_and(array $filter) : $this

If there are already existing filters, an "and" condition will be used to combine them.

Arguments

$filter

array

  • a key filter (ie: ->key_filter( array("tokenize", "-", 2), array("between", "20110601", "20110630") )

Response

$this

Adds a key filter to the map/reduce operation

key_filter_or(array $filter) : $this

If there are already existing filters, an "or" condition will be used to combine with the existing filters.

Arguments

$filter

array

Response

$this

Adds a key filter to the map/reduce operation

key_filter_operator(string $operator, array $filter) : $this

If there are already existing filters, the provided conditional operator will be used to combine with the existing filters.

Arguments

$operator

string

  • Operator (usually "and" or "or")

$filter

array

Response

$this

Performs an index search as part of a Map/Reduce operation

indexSearch(string $indexName, string $indexType, string|int $startOrExact, $end = NULL) : $this

Note that you can only do index searches on a bucket, so this is incompatible with object or key operations, as well as key filter operations.

Arguments

$indexName

string

The name of the index to search.

$indexType

string

The index type ('bin' or 'int')

$startOrExact

string|int

Start value to search for, or exact value if no end value specified.

$end

Response

$this

Run the map/reduce operation

run(integer $timeout = NULL) : \Basho\Riak\array()

Returns an array of results, or an array of Link objects if the last phase is a link phase.

Arguments

$timeout

integer

  • Timeout in seconds.

Response

\Basho\Riak\array()