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 Reuben Firmin <re...@benetech.org> on 2009/08/07 02:28:03 UTC
Attempt to query for max id failing with exception
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
Re: Attempt to query for max id failing with exception
Posted by Avlesh Singh <av...@gmail.com>.
>
> params.setQuery(queryString);
>
The query string is "*:*", right?
Your id field is sortable, right?
Cheers
Avlesh
On Fri, Aug 7, 2009 at 5:58 AM, Reuben Firmin <re...@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
>
Re: Attempt to query for max id failing with exception
Posted by Reuben Firmin <re...@benetech.org>.
Yep, thanks - this turned out to be a systems configuration error. Our
sysadmin hadn't opened up the http port on the server's internal network
interface; I could browse to it from outside (i.e. firefox on my machine),
but the apache landing page was being returned when CommonsHttpSolrServer
tried to get at it.
Reuben
On Fri, Aug 7, 2009 at 12:03 PM, Yonik Seeley <yo...@lucidimagination.com>wrote:
> 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<re...@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
> >
>
Re: Attempt to query for max id failing with exception
Posted by Yonik Seeley <yo...@lucidimagination.com>.
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<re...@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
>