1

I want to implement an application at Spring that interacts with my current Solr or SolrCloud. I consider of using Spring Data Solr or not. However I think that there is no CloudSolrServer implemented at it yet on the other hand if I just run a query like that:

http://localhost:8983/solr/replication?command=backup

and check whether backup is completed or not(I will do a get request, parse JSON and will see that last backup time is changed or not) How I can integrate it with Spring Data Solr?

I mean is it more meaningful using Spring + Solrj instead of Spring Data Solr at my situation (that is I want to do more flexible things that just CRUD operations on Solr with Spring)?

1 Answer 1

0

True, there is no support for CloudSolrServer yet. What you can do is provide you own SolrServerFactory.

public class CloudSolrServerFactory implements SolrServerFactory {

  private final CloudSolrServer solrServer;

  public CloudSolrServerFactory(String zkHost) throws MalformedURLException{
    this.solrServer = new CloudSolrServer(zkHost);
  }

  @Override
  public SolrServer getSolrServer() {
    return this.solrServer;
  }

  @Override
  public String getCore() {
    return "";
  }
}

Next you can add custom behavior to all your repositories as described in Section 1.3 of Spring Data Commons documentation. Have a look at this (not an implementation of your issue, rather general usage of custom repositories) to get the idea of how it might work.

Please feel free to open a feature request as this is definitely something missing Spring Data Solr.

2
  • SolrServerFactory uses solrj 4.1.0 How can I change it to a newer version?
    – kamaci
    Jun 4, 2013 at 0:01
  • @kamaci using maven just exclude solrj from spring-data-solr and add dependency to desired version Jun 4, 2013 at 5:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.