Why are you parsing te response to a QueryResponse object? I think it's
much easier to parse a json format response to you business object.


2013/5/14 Luis Cappa Banda <luisca...@gmail.com>

> Yeah, unfortunately that's what I'm doing right now, but parsing the
> resultant String from the HttpClient response into a QueryResponse seems to
> be imposible... I think that this would be a great feature to include in
> next Solr release. I'm sure that many people will find useful to execute
> raw String queries with SolrQuery instead setting manually that query into
> SolrQuery with the setters methods defined.
>
> Regards,
>
>
>
> 2013/5/14 Jienan Duan <jnd...@gmail.com>
>
> > I don't see any method in SolrServer like what you want.But I think you
> > just need write some code with HttpClient ,make a http request use the
> > complete query string.
> >
> > 2013/5/14 Luis Cappa Banda <luisca...@gmail.com>
> >
> > > I know that, but I was wondering if it exists another way just to set
> the
> > > complete query (including q, fq, sort, etc.) embedded in a SolrQuery
> > object
> > > as the same way that you query using some kind of RequestHandler. That
> > way
> > > would be more flexible because you don't need to parse the complete
> query
> > > checking q, fg, sort... parameters one by one and setting them with
> > > setFields(), setStart(), setRows(), etcetera. Solr is doing that query
> > > parse internally when you execute queries with it's REST API and maybe
> > > there exist a way to re-use that functionality to just set a String to
> a
> > > SolrQuery and that SolrQuery does internally all the magic.
> > >
> > > Thanks in advance,
> > >
> > >
> > > 2013/5/14 Jienan Duan <jnd...@gmail.com>
> > >
> > > > hi,
> > > > the solrQuery.setQuery() method just set the 'q' param in the query
> > > string.
> > > > You need call other method to set up all necessary param:
> > > > solrQuery.setFields(); --> this set up the 'fl' param
> > > > solrQuery.setStart(); --> this set up the 'start' param
> > > > solrQuery.setRows(); --> this set up the 'rows' param
> > > > solrQuery.setSort();  --> this set up the 'sort'param
> > > >
> > > > You can look into
> > > >
> > > >
> > >
> >
> http://lucene.apache.org/solr/4_2_1/solr-solrj/org/apache/solr/client/solrj/SolrQuery.htmlto
> > > > see more details about SolrQuery.
> > > >
> > > >
> > > > 2013/5/14 Luis Cappa Banda <luisca...@gmail.com>
> > > >
> > > > > Hello, guys!
> > > > >
> > > > > I would like to do something like this. Let's suppose we have:
> > > > >
> > > > > *
> > > > > *
> > > > > *(...) *
> > > > > *
> > > > > *
> > > > > *String query = "q=*:*&start=0&rows=20&sort=date%20desc";*
> > > > > *
> > > > > *
> > > > > *SolrQuery solrQuery = new SolrQuery();*
> > > > > *solrQuery.setQuery(query);*
> > > > > *
> > > > > *
> > > > > *server.query(solrQuery);*
> > > > > *
> > > > > *
> > > > > *(...)*
> > > > >
> > > > >
> > > > >
> > > > > I tried that and it fails. My question is: is it possible to
> define a
> > > > > SolrQuery with the complete REST encoded query String without
> parsing
> > > > > manually all the query parameters and using SolrQuery methods to
> set
> > > > them?
> > > > >
> > > > > Regards,
> > > > >
> > > > > --
> > > > > - Luis Cappa
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > ------------------------------------------------------
> > > > 不走弯路,就是捷径。
> > > > http://www.jnan.org/
> > > >
> > >
> > >
> > >
> > > --
> > > - Luis Cappa
> > >
> >
> >
> >
> > --
> > ------------------------------------------------------
> > 不走弯路,就是捷径。
> > http://www.jnan.org/
> >
>
>
>
> --
> - Luis Cappa
>



-- 
------------------------------------------------------
不走弯路,就是捷径。
http://www.jnan.org/

Reply via email to