Search code examples
grailsgrails-ormgrails-plugingrails-controller

Grails 2.3.7 Rest API - Search/Query


I am using Grails 2.3.7. I have exposed my controller as REST controller by over riding the restfull controller interface. My client is AngularJS. My CRUD operations are working fine. I have now a requirement to write search API on various objects like search on account name and number or for customer object search on customer email.

What should be an efficient and best way to write such search API? I can write an API for each search criteria but looking for something generic where a search criteria can be posted as JSON and be applied on the corresponding resource object. Is there any such generic way to implement this?

Jay


Solution

  • For Grails 3.0.8+ you can try this grails-restsearch-plugin

    It uses default GORM (don't need to use SOLR, ES or other search engines) Adds a REST and search capabilities to the project but you can ignore the REST part and use only the search