dependencies {
compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-solr', version: '1.5.9.RELEASE'
}
1. spring-data-solr-with-grails3-and-docker/grails-app/conf/docker/solr.yml
2. spring-data-solr-with-grails3-and-docker/src/main/java/spring/style/config/SolrConfiguration.java
1. spring-data-solr-with-grails3-and-docker/src/main/java/spring/style/repository/search/BlogSearchRepository.java
2. beans = {
springBlogService(spring.style.service.SpringBlogService)
}
1. Controller :: ExploreController.groovy, Service :: GrailsBlogService.groovy
2. Run grails app as it is and hit url [ http://localhost:8080/explore/index ]
3. After that browse [ http://localhost:8983/solr/#/blogs/query ]
4. Now you will see your data saved in solr server as json
5. (^_^) Before run grails app please follow point (5 _ below) to create solr blogs collection
You can use Docker to improve your grails-with-solr development experience. A number of docker-compose configuration are available in the [ grails-app/conf/docker/ ] folder to launch required third party services. For example, to start a solr in a docker container, run: below command from the project root.
docker-compose -f grails-app/conf/docker/solr.yml up -d
or
docker-compose -f grails-app/conf/docker/solr.yml up
To stop it and remove the container, run:
docker-compose -f grails-app/conf/docker/solr.yml up down
After running the solr successfully, we have to create/delete solr collection using below command from any location of terminal.
Create Collection [ grailscol, blogs ] in solr(at docker)
docker exec -it --user=solr grails-solr bin/solr create_core -c grailscol
docker exec -it --user=solr grails-solr bin/solr create_core -c blogs
Delete Collection [ grailscol, blogs ] from solr(at docker)
docker exec -it --user=solr grails-solr bin/solr delete -c grailscol
docker exec -it --user=solr grails-solr bin/solr delete -c blogs
-- End