Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude or include specific domains by package #133

Open
abowsher opened this issue Nov 4, 2015 · 5 comments
Open

Exclude or include specific domains by package #133

abowsher opened this issue Nov 4, 2015 · 5 comments

Comments

@abowsher
Copy link

abowsher commented Nov 4, 2015

I am upgrading the Weceem plugin. It switched to using ElasticSearch. Now, one of my domain classes outside of Weceem is causing an exception at startup, because it had a property named 'searchable' and ElasticSearch thinks it's the searchable closure.

I do have a few classes I've extended from Weceem for custom content types. I have no interest in making any of my other application domain classes searchable (outside of the classes in Weceem and my extensions to it). It would be great if I could tell the plugin what domain classes/packages to include/exclude.

@marcoscarceles
Copy link
Collaborator

I hope this helps...

Customize the name of the searchable property:
http://noamt.github.io/elasticsearch-grails-plugin/guide/single.html#configuration

  • elasticSearch.searchableProperty.name

The name of the ElasticSearch mapping configuration property that annotates domain classes. The default is 'searchable'.

Declare your classes o be searchable or not:
http://noamt.github.io/elasticsearch-grails-plugin/guide/single.html#quickStart

Default mapping
To declare a domain class to be searchable, the simplest way is to define the following static property in the code:
static searchable = true

@abowsher
Copy link
Author

abowsher commented Nov 4, 2015

Thanks for the reply... unfortunately that is not an easy solution either, because the content classes in the Weceem plugin use the searchable closure.

Also, I cannot put static searchable = false in my domain class, because it already has a searchable property. Even if it worked, this would force me to go through all of our classes and add this. That doesn't seem like the best solution.

@abowsher
Copy link
Author

abowsher commented Nov 4, 2015

Thankfully SearchableClassMappingConfigurator is a Spring bean, maybe I can override it with my own bean that excludes the right classes, for now.

@abowsher
Copy link
Author

My workaround almost worked (a custom Spring bean to take the place of the SearchableClassMappingConfigurator and simply only look for 'searchable' in the packages I care about)... it worked locally. But when deploying as a war to a Linux box, I get some weird exception 'MasterNotDiscoveredException'. I have no idea what that means or how to work around it, for me this plugin is buried in Weceem. I am resolved to changing my classes to not have a property named 'searchable', and see if this fixes the problem. If anyone could tell me what this exception means and how to work around it (set some environment variable? fix permissions on a directory somewhere b/c maybe it can't build the index for that reason?), that would be cool.

@abowsher
Copy link
Author

Fwiw, there were some grails options that needed to be set that I wasn't familiar with. I guess I expected Weceem to just work out of the box (well, I expected it needed configuration but not the plugins underneath it). The saving grace was this post:

http://stackoverflow.com/questions/30248690/grails-webapp-failure-to-deploy-to-aws-elasticsearch-issue

The answer there really came from this:

https://github.com/jCatalog/weceem-app/blob/master/grails-app/conf/Config.groovy#L172

(look down lower in the file, you'll see these settings):

    elasticSearch.datastoreImpl = 'hibernateDatastore'
    elasticSearch.bulkIndexOnStartup = true
    elasticSearch.disableAutoIndex = false
    elasticSearch.client.mode = 'local'
    elasticSearch.index.store.type = 'memory' // store local node 

Sorry for the verbosity, but I thought it might help someone else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants