mstein / elasticsearch-grails-plugin

ElasticSearch grails plugin
Based on Graeme Rocher initial stub. Note that it is still in early stage.
Other
62 stars 164 forks source link

Support config overrides for domain classes #19

Open pledbrook opened 12 years ago

pledbrook commented 12 years ago

At the moment, you have no control over the indexing of domain classes provided by plugins. It would be good to allow configuration options along the lines of:

elasticSearch {
    domain {
        comment = {
            root false
            only = ["body"]
            body name: "comment"
        }
        tag = true
        screencast = [only: ["title", "description"]]
    }
}

Each configuration setting of the form elasticSearch.domain.* would be one of a boolean, a map, or a closure just as with the searchable domain class property. But these configuration settings would override any value provided by the domain class property.

This will require a refactoring. I suggest changing ClosureSearchableDomainClassMapper to be SearchableDomainClassMapper and the class should delegate to separate BooleanSearchableConfig, MapSearchableConfig and ClosureSearchableConfig classes based on the type of the searchable property.

I'm not sure how best to handle the reading of the searchable property and the above configuration settings. They may overlap, but you may have some domain classes in the runtime configuration that don't have a searchable property and vise-versa.