elasticsearch-grails-plugin icon indicating copy to clipboard operation
elasticsearch-grails-plugin copied to clipboard

Support config overrides for domain classes

Open pledbrook opened this issue 12 years ago • 0 comments

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.

pledbrook avatar Mar 27 '12 16:03 pledbrook