我想在现有表上使用scala和查询连接solr节点。我们如何在解析错误solr查询后使用查询,如:
select * from keyspace.table where solr_query = 'id: [1000 TO 2000]';
我的代码在这里:
object SolrTest {
def main(args:Array[String]) {
val url = "https://xx.xx.xx.xxx:8983/solr"
val httpClient: DefaultHttpClient = new DefaultHttpClient()
httpClient.getCredentialsProvider().setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("XXXXX", "123456"))
val server: HttpSolrServer = new HttpSolrServer(url, httpClient)
val query = new SolrQuery()
val myquery = query.setQuery("*:*")
val response: QueryResponse = server.query(myquery)
println("my response : "+ response)
}
}
连接服务器成功连接。收到以下错误后:
Exception in thread "main" org.apache.solr.client.solrj.SolrServerException: IOException occured when talking to server at: https://xx.xx.xx.xxx:8983/solr
at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:437)
at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:180)
at org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:90)
at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:301)
at com.test.SolrTest$.main(SolrTest.scala:29)
at com.test.SolrTest.main(SolrTest.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated