parameters:
    env(ES_URL): 'localhost'
    env(ES_PORT): '9200'

# Read the documentation: https://github.com/FriendsOfSymfony/FOSElasticaBundle/blob/master/Resources/doc/setup.md
fos_elastica:
    clients:
        default: { host: '%env(resolve:ES_URL)%', port: '%env(resolve:ES_PORT)%' }
    serializer: ~

    indexes:

        appfilm:
            index_name: cinematheque_film_index_%kernel.environment%
            settings:
                number_of_replicas: 0 # because only one ES node
                index:
                    analysis:
                        #                        analyzer:
                        #                            my_analyzer:
                        #                                type: custom
                        #                                tokenizer: lowercase
                        #                                filter   : [my_ngram]
                        analyzer:
                            #                            my_ngram:
                            #                                type: "nGram"
                            #                                min_gram: 3
                            #                                max_gram: 5

                            default:
                                type: "custom"
                                char_filter: html_strip
                                tokenizer: "standard" # "my_edge_ngram_tokenizer"
                                filter: [ trim, lowercase, stop_fr, fr_stemmer, my_edge_ngram_filter, asciifolding ]
                            default_search:
                                type: custom
                                tokenizer: standard
                                filter: [ trim, lowercase, stop_fr, fr_stemmer, asciifolding ]
                        #                            mots_clefs:
                        #                                type: "custom"
                        #                                tokenizer: "keyword"
                        #                                filter: [ standard, trim, lowercase, asciifolding ]
                        #                        tokenizer:
                        #                            my_edge_ngram_tokenizer:
                        #                                type: "edgeNGram"
                        #                                min_gram: "2"
                        #                                max_gram: "20"
                        #                                token_chars: [ "letter", "digit" ]
                        filter:
                            my_edge_ngram_filter:
                                type: "edgeNGram"
                                min_gram: "3"
                                max_gram: "20"
                            stop_fr:
                                type: "stop"
                                stopwords: [ _french_ ]
                            fr_stemmer:
                                type: "stemmer"
                                name: "french"
            properties:
                titre: { boost: 10 }
                titrevo: { boost: 5 }
            serializer:
                groups: [ elastica ]
                #serialize_null: true
            persistence:
                driver: orm
                model: App\Entity\Film
                provider: ~
                finder: ~
                repository: App\SearchRepository\FilmRepository
#
#            types:
#
#                film:
#                    serializer:
#                        groups: [elastica]
#                        #serialize_null: true
#                    properties:
#                        titre: { boost: 10 }
#                        titrevo: { boost: 5 }
#                    persistence:
#                        driver: orm
#                        model: App\Entity\Film
#                        provider: ~
#                        finder: ~
#                        repository: App\SearchRepository\FilmRepository


        appevent:
            index_name: cinematheque_event_index_%kernel.environment%
            settings:
                number_of_replicas: 0 # because only one ES node
                index:
                    analysis:
                        analyzer:
                            default:
                                type: "custom"
                                char_filter: html_strip
                                tokenizer: "standard" # "my_edge_ngram_tokenizer"
                                filter: [ trim, lowercase, stop_fr, fr_stemmer, my_edge_ngram_filter, asciifolding ]
                            default_search:
                                type: custom
                                tokenizer: standard
                                filter: [ trim, lowercase, stop_fr, fr_stemmer, asciifolding ]
                        filter:
                            my_edge_ngram_filter:
                                type: "edgeNGram"
                                min_gram: "3"
                                max_gram: "20"
                            stop_fr:
                                type: "stop"
                                stopwords: [ _french_ ]
                            fr_stemmer:
                                type: "stemmer"
                                name: "french"
            properties:
                titre: { boost: 10 }
                description: ~
            serializer:
                groups: [ elastica ]
            persistence:
                driver: orm
                model: App\Entity\Evenement
                provider: ~
                finder: ~
                repository: App\SearchRepository\EvenementRepository
#            types:
#                evenement:
#                    serializer:
#                        groups: [elastica]
#                    properties:
#                        titre: { boost: 10 }
#                        description: ~
#                    persistence:
#                        driver: orm
#                        model: App\Entity\Evenement
#                        provider: ~
#                        finder: ~
#                        repository: App\SearchRepository\EvenementRepository