Configuration ElasticaBundle Analyzer

Bonjour,

J'essaie, tant bien que mal, de configurer mon analyzer pour ElasticSearch avec ElastiaBundle.

Mais j'ai l'impression que celui-ci n'est pas pris en compte.

Voici la configuration :

fos_elastica:
    indexes:
        app:
            client: default
            settings:
                  analysis:
                    analyzer:
                      custom_analyzer :
                        type     :    custom
                        tokenizer:    nGram
                        filter   :    [my_stopwords, asciifolding ,lowercase, snowball, my_elision, worddelimiter]
                      custom_search_analyzer :
                        type     :    custom
                        tokenizer:    standard
                        filter   :    [my_stopwords, asciifolding ,lowercase, snowball, my_elision, worddelimiter]
                    filter:
                      snowball:
                        type:     snowball
                        language: French
                      my_elision:
                        type:     elision
                        articles: ["l", "m", "t", "qu", "n", "s", "j", "d"]
                      my_stopwords:
                        type:      stop
                        stopwords: [_french_]
                        ignore_case : true
                      worddelimiter :
                        type:      word_delimiter

Et voici un de mes mappings :

##### Document #####
                Document:
                    mappings: 
                        id: ~
                        title:
                            index_analyzer: custom_analyzer
                            search_analyzer : custom_search_analyzer
                        resume:
                            index_analyzer: custom_analyzer
                            search_analyzer : custom_search_analyzer
                        date: ~
                        documentType:   
                            type: object
                            properties:
                                id: ~
                                name: ~
                        files:
                            type: object
                            properties:
                                id: ~
                                name: ~
                                path : ~
                    persistence:
                        driver: orm
                        model:  ManageBundle\Entity\Document
                        repository: ManageBundle\RepositoryElastica\DocumentRepositoryElastica
                        provider: ~
                        listener: ~
                        finder: ~

Ensuite, depuis mon terminal je fais : php app/console fos:elastica:populate

Mais mon analyzer custom n'est pas du tout pris en compte et je n'arrive pas à voir pourquoi.

SI quelqu'un pouvait m"aider, ce serait bien car je cherche depuis 1 semaine et j'ai rien trouvé

D'avance, Merci !

Benjamin

Que donne un GET ton_index/_mapping ?

Le Mapping donne :


"Document": { "_meta": { "model": "ManageBundle\Entity\Document"},"properties": { "authors": { "properties": { "id": { "type": "integer"},"name": { "type": "string"},"nationality": { "properties": { "id": { "type": "integer"},"name": { "type": "string"}}}}},"date": { "type": "date","format": "date_time_no_millis"},"documentType": { "properties": { "id": { "type": "integer"},"name": { "type": "string"}}},"events": { "properties": { "id": { "type": "integer"},"name": { "type": "string"}}},"files": { "properties": { "id": { "type": "integer"},"name": { "type": "string"},"path": { "type": "string"}}},"id": { "type": "integer"},"resume": { "type": "string"},"tags": { "properties": { "id": { "type": "integer"},"name": { "type": "string"}}},"title": { "type": "string"}}},

Please format your code using </> icon as explained in this guide. It will make your post more readable.

Or use markdown style like:

```
CODE
```

Tu peux donner le résultat complet de GET ton_index/_mapping?pretty STP?

Mince, désolé !

"Document": {

    "_meta": {
        "model": "ManageBundle\Entity\Document"
    },
    "properties": {
        "authors": {
            "properties": {
                "id": {
                    "type": "integer"
                },
                "name": {
                    "type": "string"
                },
                "nationality": {
                    "properties": {
                        "id": {
                            "type": "integer"
                        },
                        "name": {
                            "type": "string"
                        }
                    }
                }
            }
        },
        "date": {
            "type": "date",
            "format": "date_time_no_millis"
        },
        "documentType": {
            "properties": {
                "id": {
                    "type": "integer"
                },
                "name": {
                    "type": "string"
                }
            }
        },
        "events": {
            "properties": {
                "id": {
                    "type": "integer"
                },
                "name": {
                    "type": "string"
                }
            }
        },
        "files": {
            "properties": {
                "id": {
                    "type": "integer"
                },
                "name": {
                    "type": "string"
                },
                "path": {
                    "type": "string"
                }
            }
        },
        "id": {
            "type": "integer"
        },
        "resume": {
            "type": "string"
        },
        "tags": {
            "properties": {
                "id": {
                    "type": "integer"
                },
                "name": {
                    "type": "string"
                }
            }
        },
        "title": {
            "type": "string"
        }
    }

},

Est-ce qu'il y a autre chose après }, ou quelque chose avant "Document": {?

Peux-tu envoyer le résultat complet?

Egalement le résultat de GET ton_index/_settings?pretty?

Est-ce que tu détruis bien l'index existant quand tu relances ton application?
Sinon je suppose que ce n'est pas écrasé.

Voici le résultat complet:

{
    "app": {
        "mappings": {
            "Tag": {
                "_meta": {
                    "model": "ManageBundle\Entity\Tag"
                },
                "properties": {
                    "documents": {
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "title": {
                                "type": "string"
                            }
                        }
                    },
                    "id": {
                        "type": "integer"
                    },
                    "name": {
                        "type": "string"
                    },
                    "tagCategory": {
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "name": {
                                "type": "string"
                            }
                        }
                    },
                    "tagColor": {
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "name": {
                                "type": "string"
                            }
                        }
                    }
                }
            },
            "Event": {
                "_meta": {
                    "model": "ManageBundle\Entity\Event"
                },
                "properties": {
                    "date": {
                        "type": "string"
                    },
                    "documents": {
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "title": {
                                "type": "string"
                            }
                        }
                    },
                    "id": {
                        "type": "integer"
                    },
                    "name": {
                        "type": "string"
                    }
                }
            },
            "Author": {
                "_meta": {
                    "model": "ManageBundle\Entity\Author"
                },
                "properties": {
                    "companies": {
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "name": {
                                "type": "string"
                            }
                        }
                    },
                    "documents": {
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "title": {
                                "type": "string"
                            }
                        }
                    },
                    "id": {
                        "type": "integer"
                    },
                    "name": {
                        "type": "string"
                    },
                }
            },
            "Document": {
                "_meta": {
                    "model": "ManageBundle\Entity\Document"
                },
                "properties": {
                    "authors": {
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "name": {
                                "type": "string"
                            },
                            "nationality": {
                                "properties": {
                                    "id": {
                                        "type": "integer"
                                    },
                                    "name": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    },
                    "date": {
                        "type": "date",
                        "format": "date_time_no_millis"
                    },
                    "documentType": {
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "name": {
                                "type": "string"
                            }
                        }
                    },
                    "events": {
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "name": {
                                "type": "string"
                            }
                        }
                    },
                    "files": {
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "name": {
                                "type": "string"
                            },
                            "path": {
                                "type": "string"
                            }
                        }
                    },
                    "id": {
                        "type": "integer"
                    },
                    "resume": {
                        "type": "string"
                    },
                    "tags": {
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "name": {
                                "type": "string"
                            }
                        }
                    },
                    "title": {
                        "type": "string"
                    }
                }
            },
            "File": {
                "_meta": {
                    "model": "ManageBundle\Entity\File"
                },
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "name": {
                        "type": "string"
                    },
                    "type": {
                        "type": "string"
                    }
                }
            }
        }
    }
}

Comment puis-je voir si je détruis bien l'index quand je relance l'application ?

DELETE app.

Ou en curl:

curl -XDELETE localhost:9200/app

Ah d'accord, avant de relancer mon application, je dois détruire l'index et le reconstruire c'est ça ?

Je suppose. Je ne sais pas comment fonctionne ElasticaBundle

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.