You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by shb <su...@gmail.com> on 2009/07/08 12:06:28 UTC

how to do the distributed search with sort using solr?

In my project, I am trying to do a distributed search sorted by some field
using solr. The test code is
as follows:

SolrQuery query = new SolrQuery();
query.set("q", "id:[1 TO *]");
query.setSortField("id",SolrQuery.ORDER.asc);
query.setParam("shards", "localhost:8983/solr, localhost:7574/solr");
QueryResponse response = server.query(query);

I get the following error. It seems that solr doesn't support the sort
function while doing the
distributed search.  Do you have any suggestions to solve this problem,
thanks!

org.apache.solr.client.solrj.SolrServerException: Error executing query
    at
org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:103)
    at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:115)
    at test.MainClassTest.searchTest(MainClassTest.java:88)
    at test.MainClassTest.main(MainClassTest.java:48)
Caused by: org.apache.solr.client.solrj.SolrServerException:
java.net.ConnectException: Connection refused
    at
org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:391)
    at
org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:183)
    at
org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:95)
    ... 3 more

Re: how to do the distributed search with sort using solr?

Posted by shb <su...@gmail.com>.
>java.net.ConnectException: Connection refused
>  at
>org.apache.solr.client.solrj.
>impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:391)

The "Connection refused" error is caused becaused that the servers have been
stopped.

I>Are you sure both servers are running properly? You can hit them
> individually?

I start both servers and if I comment out "query.setParam("shards",
"localhost:8983/solr, localhost:7574/solr");  " or
"query.setSortField("id",SolrQuery.ORDER.asc);", it will both
work correctly.

However, if I keep them both in the program, I got the error as follows:

  org.apache.solr.client.solrj.SolrServerException: Error executing query
    at
org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:103)
    at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:115)
    at test.MainClassTest.searchTest(MainClassTest.java:88)
    at test.MainClassTest.main(MainClassTest.java:48)

Re: how to do the distributed search with sort using solr?

Posted by Mark Miller <ma...@gmail.com>.
On Wed, Jul 8, 2009 at 6:45 AM, shb <su...@gmail.com> wrote:

> Sorry, the error is as follows. I have read the solr wiki carefully and
> google it, but I haven't founded
> any related question or solution,  any one can help me, thanks!
>
> org.apache.solr.client.solrj.SolrServerException: Error executing query
>    at
>
> org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:103)
>    at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:115)
>    at test.MainClassTest.searchTest(MainClassTest.java:88)
>    at test.MainClassTest.main(MainClassTest.java:48)
> Caused by: org.apache.solr.common.SolrException:
>


java.net.ConnectException: Connection refused
   at
org.apache.solr.client.solrj.
impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:391)

Are you sure both servers are running properly? You can hit them
individually?


-- 
-- 
- Mark

http://www.lucidimagination.com

Re: how to do the distributed search with sort using solr?

Posted by shb <su...@gmail.com>.
Sorry, the error is as follows. I have read the solr wiki carefully and
google it, but I haven't founded
any related question or solution,  any one can help me, thanks!

org.apache.solr.client.solrj.SolrServerException: Error executing query
    at
org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:103)
    at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:115)
    at test.MainClassTest.searchTest(MainClassTest.java:88)
    at test.MainClassTest.main(MainClassTest.java:48)
Caused by: org.apache.solr.common.SolrException: