lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yonik Seeley <yo...@lucidimagination.com>
Subject Re: Attempt to query for max id failing with exception
Date Fri, 07 Aug 2009 16:03:49 GMT
I just tried this sample code... it worked fine for me on trunk.

-Yonik
http://www.lucidimagination.com

On Thu, Aug 6, 2009 at 8:28 PM, Reuben Firmin<reubenf@benetech.org> wrote:
> 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
>

Mime
View raw message