Open meenarc opened 10 years ago
@meenarc yes. just use the type you want eg. CloudSolrServer
in your configuration.
@Bean
public SolrServer solrServer() {
return new CloudSolrServer("http://127.0.0.1/zk", new LBHttpSolrServer("http://127.0.0.1:8983/solr_1", "http://127.0.0.1:8983/solr_2"));
}
So can the CloudSolrServer API be used , even in case of private clustered Solr installations. Like we are planning a DataStax Solr clustered set up
Actually I never tested it against DataStax.
I have another question-Can Spring Data Solr be used in a JRE 6 environment
that pretty much depends on the solr-solrj
version you're using. As off org.apache.solr:solr-solrj:4.8.0
you'll require to have at least Java 7.
But can I assume that 1.3.0.RELEASE of spring-data-solr would be tied to SolrJ 4.7.2? If you were to upgrade to using SolrJ 4.8 would it mean that there would be a newer version of spring-data-solr and to that extent I can go by the release version of spring-data-solr?
You can expect sd-solr 1.3.x to stick with the solrj 4.7.x line.
We plan to upgrade solrj in 1.4.0 but keep spring-data-solr itself 1.6 compatible so that you sill can use it along with solrj 4.7.x in a Java 6 environment.
I had tried to set up the Solr Template as follows
<bean id="solrTemplate" class="org.springframework.data.solr.core.SolrTemplate" >
<constructor-arg ref="solrServer" />
<constructor-arg index="1" value="${solr.core.datapages:datapages.spreadsheet_test}"/>
</bean>
Anytime I use the SolrTemplate I run into Caused by: org.apache.solr.client.solrj.SolrServerException: IOException occured when talking to server at: http://10.63.20.128:8983/solr/datapages.spreadsheet_test at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:507) at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:199) at org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:91) at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:301) at org.springframework.data.solr.core.SolrTemplate$11.doInSolr(SolrTemplate.java:353) at org.springframework.data.solr.core.SolrTemplate$11.doInSolr(SolrTemplate.java:350) at org.springframework.data.solr.core.SolrTemplate.execute(SolrTemplate.java:132) ... 40 more Caused by: org.apache.http.conn.ConnectTimeoutException: Connect to 10.63.20.128:8983 timed out at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:129) at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180)
But when I use the SolrJ API directly as follows I am able to fetch results.
HttpSolrServer solrServer=new HttpSolrServer("http://10.63.20.128:8983/solr/datapages.spreadsheet_test") ; SolrQuery query = new SolrQuery(); .......... solrServer.query(query);
In both cases the maven dependency is on the 1.3.0 RELEASE, so the SolrJ used above is the same as the one that used by the underlying Spring jars.
@meenarc would you mind including your referenced solrServer
bean definition?
solr:solr-server id="solrServer" url="http://10.63.20.128:8983/solr"
The previous comment got badly formatted and am not sure if you got to view the contents.I just removed the end and clsoing tags of the solr bean definition I have and pasted it above since that seems to impact formatting.
hmm... well that's strange. Would you mind opening an issue in JIRA. It would be really helpful if you could include (gist maybe) a small sample reproducing the error. thanks!
Does Spring-Data-Solr handle client side failover,load balancing across multiple solr nodes(something like http://wiki.apache.org/solr/LBHttpSolrServer?)