1
votes

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

1 Answers

0
votes

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.