Build a Index Map-Reduce command object

@return \Riak\Client\Command\MapReduce\IndexMapReduce
516800
public function build()
    {
        $input = new IndexInput($this->namespace, $this->indexName, $this->criteria);
        $spec  = new Specification($input, $this->phases, $this->timeout);

        return new IndexMapReduce($spec);
    }
1274115
public function buildList()
	{
		$this->setListMapper(new ListMapper);
		$this->configureList($this->getListMapper());

		$this->setListBuilder(new ListBuilder($this->getListMapper()));
		$this->getListBuilder()
			->setModel($this->getModel())
			->build();

		return $this;
	}
397673
protected function _createIndexIfNotExists() {
        $service        = $this->getService();
        $indexExists    = $service->doesIndexExist();

        if ($indexExists) {
            return self::MSG_INDEX_EXISTS;
        }

        return $service->createIndex()
            ? self::MSG_INDEX_CREATED
            : self::MSG_INDEX_CREATION_FAILURE;
    }
1037376
public function startIndexing()
    {
        $directories = $this->indexerConfig['directories'];
        $directoryArray = GeneralUtility::trimExplode(',', $directories, true);

        if ($this->pObj->indexerConfig['fal_storage'] > 0) {
            /* @var $storageRepository StorageRepository */
            $storageRepository = GeneralUtility::makeInstance(StorageRepository::class);
            $this->storage = $storageRepository->findByUid($this->pObj->indexerConfig['fal_storage']);

            $files = array();
            $this->getFilesFromFal($files, $directoryArray);
        } else {
            $files = $this->getFilesFromDirectories($directoryArray);
        }

        $counter = $this->extractContentAndSaveToIndex($files);

        // show indexer content?
        $content = '<p><b>Indexer "' . $this->indexerConfig['title'] . '": </b><br />'
            . count($files) . ' files have been found for indexing.<br />' . "\n"
            . $counter . ' files have been indexed.</p>' . "\n";

        $content .= $this->showErrors();
        $content .= $this->showTime();

        return $content;
    }
40564
public function mapReduceOptions(array $options)
    {
        if ($this->query['type'] !== Query::TYPE_MAP_REDUCE) {
            throw new BadMethodCallException('This method requires a mapReduce command (call map() or mapReduce() first)');
        }

        $this->query['mapReduce']['options'] = $options;
        return $this;
    }
1134863
protected function buildPropertyMap()
    {
        $map = [];
        $properties = (new ReflectionObject($this))->getProperties(ReflectionProperty::IS_PUBLIC);

        foreach ($properties as $property) {
            $map[$property->getName()] = $property;
        }

        return $map;
    }
478643
public function finalize($finalize)
    {
        switch ($this->query['type']) {
            case Query::TYPE_MAP_REDUCE:
                $this->query['mapReduce']['options']['finalize'] = $finalize;
                break;

            case Query::TYPE_GROUP:
                $this->query['group']['options']['finalize'] = $finalize;
                break;

            default:
                throw new BadMethodCallException('mapReduce(), map() or group() must be called before finalize()');
        }

        return $this;
    }
319653
public function map()
    {
        $map = config('db-exporter.model.map');

        foreach ($map as $item) {
            // Find matching table name
            $tablePattern = '/' . str_replace('/', '\/', $item['tablePattern']) . '/';
            if (preg_match($tablePattern, $this->table->getTableName()) === 1) {
                $this->path      = $item['path'];
                $this->namespace = $item['namespace'];

                if ($item['className'] !== null) {
                    $pattern     = '/' . str_replace('/', '\/', $item['className']['pattern']) . '/';
                    $replacement = $item['className']['replacement'];
                    echo $replacement;
                    $this->class = preg_replace($pattern, $replacement, $this->class);
                }
                break;
            }
        }
    }
513802
public function map()
    {
        $args = func_get_args();
        $methods = array_shift($args);
        $methods = is_array($methods) ? $methods : explode(',', $methods);

        foreach ($methods as $method) {
            $method = strtoupper($method);
            $this->setRoute($method, $args);
        }
        return $this;
    }
1372393
public function mapReduce($map, $reduce, $out = ['inline' => true], array $options = [])
    {
        $this->query['type'] = Query::TYPE_MAP_REDUCE;
        $this->query['mapReduce'] = [
            'map' => $map,
            'reduce' => $reduce,
            'out' => $out,
            'options' => $options
        ];
        return $this;
    }
292249
protected function createTargetIndex()
    {
        $targetIndex = $this->argument('target-index');

        $sourceIndexConfigurator = $this->getModel()
            ->getIndexConfigurator();

        $payload = (new RawPayload())
            ->set('index', $targetIndex)
            ->setIfNotEmpty('body.settings', $sourceIndexConfigurator->getSettings())
            ->setIfNotEmpty('body.mappings._default_', $sourceIndexConfigurator->getDefaultMapping())
            ->get();

        ElasticClient::indices()
            ->create($payload);

        $this->info(sprintf(
            'The %s index was created.',
            $targetIndex
        ));
    }
1307881
function _prepareReduce($x, $n, $mode)
    {
        if ($mode == self::MONTGOMERY) {
            return $this->_prepMontgomery($x, $n);
        }
        return $this->_reduce($x, $n, $mode);
    }
671377
public static function getMapping()
    {
        $instance = new static();

        $params = $instance->getBasicEsParams();

        return $instance->getElasticSearchClient()->indices()->getMapping($params);
    }
891931
private function buildParentMap()
    {
        $map = [];

        foreach ($this->configurations as $configuration) {
            if (null !== $parentId = $configuration->getParentId()) {
                $map[$configuration->getResourceId()] = $parentId;
            }
        }

        ksort($map);

        return $map;
    }
604233
public function createIndex(): bool
    {
        $class = $this->class;

        $indexParams = [
            'index' => $this->index,
        ];

        if (count($this->notAnalyzedFields)) {
            $indexParams['body'] = [
                'mappings' => [
                    $class => [
                        '_source'    => [
                            'enabled' => true
                        ],
                        'properties' => $this->createNotAnalyzedFieldsMapping($this->notAnalyzedFields),
                    ]
                ]
            ];
        }

        $this->client->indices()->create($indexParams);
        $response = $this->client->cluster()->health([
            'index'           => $this->index,
            'wait_for_status' => 'yellow',
            'timeout'         => '5s',
        ]);

        return isset($response['status']) && $response['status'] !== 'red';
    }
112627
public function getIterator()
    {
        return new Map_Iterator(
            $this->list->getIterator(),
            $this->keyField,
            $this->valueField,
            $this->firstItems,
            $this->lastItems
        );
    }
803417
public function rebuild($indexName)
    {
        $commandClass = $this->getCommandClass('index.rebuild');
        $this->command = new $commandClass($indexName);

        return $this->command;
    }