Yes, your are right. I was trying to indent the solr json response.
Actually, Solr Json response is not exactly json, i couldnt understand the
output format. But found a solution yo solve the problem, i mean making
json and indenting the solr result set. Here is the code segment.

public class SolrjTest {


    public static void main(String[] args) throws Exception{
        ClassPathXmlApplicationContext c = new
ClassPathXmlApplicationContext("/patrades-search-solrj-test-beans.xml");
        SolrServer server = (SolrServer)c.getBean("solrServer");
        SolrQuery query = new SolrQuery();
        query.setQuery( "marka_s:atak*" );
        System.err.println(query.toString());
        QueryResponse rsp = server.query( query );
        List<PatradesSolrBean> beans = rsp.getBeans(PatradesSolrBean.class);
        ObjectMapper om = new ObjectMapper();
        String s =
om.defaultPrettyPrintingWriter().writeValueAsString(beans);
        System.err.println(s);
    }
}

On Mon, Nov 28, 2011 at 9:10 PM, Erick Erickson <erickerick...@gmail.com>wrote:

> I'm not sure what you're really after here. Indent how?
>
> The indent parameter is to make the reply readable, it really
> has nothing to do with printing the query.
>
> Could you show an example of what you want for output?
>
> Best
> Erick
>
> On Mon, Nov 28, 2011 at 8:42 AM, halil <halil.a...@gmail.com> wrote:
> > I step one more. but still no indent. I wrote below code segment
> >
> >  query.setQuery( "marka_s:atak*" )
> >            .setFacet(true)
> >            .setParam("indent", "on")
> >            ;
> >
> > and here is the resulted query string
> >
> > q=marka_s%3Aatak*&facet=true&indent=on
> >
> > -halil agin.
> >
> > On Mon, Nov 28, 2011 at 3:07 PM, halil <halil.a...@gmail.com> wrote:
> >
> >> Hi List,
> >>
> >> I am new to Solr and lucene world. I have a simple question. I wrote
> below
> >> code segment and it works.
> >>
> >> public class SolrjTest {
> >>
> >>
> >>     public static void main(String[] args) throws MalformedURLException,
> >> SolrServerException{
> >>         ClassPathXmlApplicationContext c = new
> >> ClassPathXmlApplicationContext("/patrades-search-solrj-test-beans.xml");
> >>         SolrServer server = (SolrServer)c.getBean("solrServer");
> >>         SolrQuery query = new SolrQuery();
> >>         query.setQuery( "*:*" )
> >>             .setFacet(true)
> >>             ;
> >>         QueryResponse rsp = server.query( query );
> >>         System.err.println(rsp.toString());
> >>     }
> >> }
> >>
> >>
> >> I want to indent the response string, but couldnt find any answer. I
> >> looked at book, mail archive and google.  Most relevant link is below
> >>
> >> http://wiki.apache.org/solr/SimpleFacetParameters
> >>
> >> but i dont know how to use it. Api is hard to read by the way.
> >>
> >> regards,
> >>
> >> -Halil AĞIN
> >>
> >
>

Reply via email to