public function getClientAnalysis(array $bundles, $analysisConfig = [])
    {
        $cacheName = 'ongr.metadata.analysis.'.md5(serialize($bundles));
        $this->enableCache && $typesAnalysis = $this->cache->fetch($cacheName);

        if (isset($typesAnalysis) && false !== $typesAnalysis) {
            return $typesAnalysis;
        }

        $typesAnalysis = [
            'analyzer' => [],
            'filter' => [],
            'tokenizer' => [],
            'char_filter' => [],
            'normalizer' => [],
        ];

        /** @var array $mappings All mapping info */
        $mappings = $this->getMappings($bundles);

        foreach ($mappings as $type => $metadata) {
            foreach ($metadata['analyzers'] as $analyzerName) {
                if (isset($analysisConfig['analyzer'][$analyzerName])) {
                    $analyzer = $analysisConfig['analyzer'][$analyzerName];
                    $typesAnalysis['analyzer'][$analyzerName] = $analyzer;
                    $typesAnalysis['filter'] = $this->getAnalysisNodeConfiguration(
                        'filter',
                        $analyzer,
                        $analysisConfig,
                        $typesAnalysis['filter']
                    );
                    $typesAnalysis['tokenizer'] = $this->getAnalysisNodeConfiguration(
                        'tokenizer',
                        $analyzer,
                        $analysisConfig,
                        $typesAnalysis['tokenizer']
                    );
                    $typesAnalysis['char_filter'] = $this->getAnalysisNodeConfiguration(
                        'char_filter',
                        $analyzer,
                        $analysisConfig,
                        $typesAnalysis['char_filter']
                    );
                }
            }
        }

        if (isset($analysisConfig['normalizer'])) {
            $typesAnalysis['normalizer'] = $analysisConfig['normalizer'];
        }

        $this->enableCache && $this->cache->save($cacheName, $typesAnalysis);

        return $typesAnalysis;
    }
public function getClientAnalysis(array $bundles, $analysisConfig = [])
    {
        $cacheName = 'ongr.metadata.analysis.'.md5(serialize($bundles));
        $this->enableCache && $typesAnalysis = $this->cache->fetch($cacheName);

        if (isset($typesAnalysis) && false !== $typesAnalysis) {
            return $typesAnalysis;
        }

        $typesAnalysis = [
            'analyzer' => [],
            'filter' => [],
            'tokenizer' => [],
            'char_filter' => [],
            'normalizer' => [],
        ];

        /** @var array $mappings All mapping info */
        $mappings = $this->getMappings($bundles);

        foreach ($mappings as $type => $metadata) {
            foreach ($metadata['analyzers'] as $analyzerName) {
                if (isset($analysisConfig['analyzer'][$analyzerName])) {
                    $analyzer = $analysisConfig['analyzer'][$analyzerName];
                    $typesAnalysis['analyzer'][$analyzerName] = $analyzer;
                    $typesAnalysis['filter'] = $this->getAnalysisNodeConfiguration(
                        'filter',
                        $analyzer,
                        $analysisConfig,
                        $typesAnalysis['filter']
                    );
                    $typesAnalysis['tokenizer'] = $this->getAnalysisNodeConfiguration(
                        'tokenizer',
                        $analyzer,
                        $analysisConfig,
                        $typesAnalysis['tokenizer']
                    );
                    $typesAnalysis['char_filter'] = $this->getAnalysisNodeConfiguration(
                        'char_filter',
                        $analyzer,
                        $analysisConfig,
                        $typesAnalysis['char_filter']
                    );
                }
            }
        }

        if (isset($analysisConfig['normalizer'])) {
            $typesAnalysis['normalizer'] = $analysisConfig['normalizer'];
        }

        $this->enableCache && $this->cache->save($cacheName, $typesAnalysis);

        return $typesAnalysis;
    }
public function getClientAnalysis ( array $ bundles , $ analysisConfig = [ ] ) { $ cacheName = 'ongr.metadata.analysis.' . md5 ( serialize ( $ bundles ) ) ; $ this -> enableCache && $ typesAnalysis = $ this -> cache -> fetch ( $ cacheName ) ; if ( isset ( $ typesAnalysis ) && false !== $ typesAnalysis ) { return $ typesAnalysis ; } $ typesAnalysis = [ 'analyzer' => [ ] , 'filter' => [ ] , 'tokenizer' => [ ] , 'char_filter' => [ ] , 'normalizer' => [ ] , ] ; /** @var array $mappings All mapping info */ $ mappings = $ this -> getMappings ( $ bundles ) ; foreach ( $ mappings as $ type => $ metadata ) { foreach ( $ metadata [ 'analyzers' ] as $ analyzerName ) { if ( isset ( $ analysisConfig [ 'analyzer' ] [ $ analyzerName ] ) ) { $ analyzer = $ analysisConfig [ 'analyzer' ] [ $ analyzerName ] ; $ typesAnalysis [ 'analyzer' ] [ $ analyzerName ] = $ analyzer ; $ typesAnalysis [ 'filter' ] = $ this -> getAnalysisNodeConfiguration ( 'filter' , $ analyzer , $ analysisConfig , $ typesAnalysis [ 'filter' ] ) ; $ typesAnalysis [ 'tokenizer' ] = $ this -> getAnalysisNodeConfiguration ( 'tokenizer' , $ analyzer , $ analysisConfig , $ typesAnalysis [ 'tokenizer' ] ) ; $ typesAnalysis [ 'char_filter' ] = $ this -> getAnalysisNodeConfiguration ( 'char_filter' , $ analyzer , $ analysisConfig , $ typesAnalysis [ 'char_filter' ] ) ; } } } if ( isset ( $ analysisConfig [ 'normalizer' ] ) ) { $ typesAnalysis [ 'normalizer' ] = $ analysisConfig [ 'normalizer' ] ; } $ this -> enableCache && $ this -> cache -> save ( $ cacheName , $ typesAnalysis ) ; return $ typesAnalysis ; }
Prepares analysis node for Elasticsearch client.

@param array $bundles
@param array $analysisConfig

@return array
Prepares analysis node for Elasticsearch client .