I'm using SolrJ. When I attempt to set up a query to retrieve the maximum id
in the index, I'm getting an exception.

My setup code is:

     final SolrQuery params = new SolrQuery();
     params.addSortField("id", ORDER.desc);
     params.setRows(1);
     params.setQuery(queryString);
....
     final QueryResponse queryResponse = server.query(params);

This latter line is blowing up with:

Not Found

request: 
http://solr.xxx.myserver/select?sort=iddesc&rows=1&q=*:*&wt=javabin&version=2.2
org.apache.solr.common.SolrException
org.apache.solr.client.solrj.impl.CommonsHttpSolrServer#request(343)
        org.apache.solr.client.solrj.impl.CommonsHttpSolrServer#request(183)
        org.apache.solr.client.solrj.request.QueryRequest#process(90)
        org.apache.solr.client.solrj.SolrServer#query(109)

There are a couple things to note -

   - there is a space between id and desc which looks suspicious, but
   swapping changing wt to XML and leaving the URL otherwise the same causes
   solr no grief when queried via a browser
   - the index is in fact empty - this particular section of code is bulk
   loading our documents, and using the max id query to figure out where to
   start from. (I can and will try catching the exception and assuming 0, but
   ideally I wouldn't get an exception just from doing the query)

Am I doing this query in the wrong way?

Thanks
Reuben

Reply via email to