Hi,

I see that you have ampersand left when setting various parameters. 

  query.set("&wt", "xslt");

should be 

  query.set("wt", "xslt");
       



On Thursday, June 12, 2014 6:12 PM, Venkata krishna <venkat1...@gmail.com> 
wrote:



Hi,

I am using solr4.8, solrj  for to do searching, would like to get response
of search query in html format,for that purpose i have written this code, 
private static final String urlString = "http://localhost:8983/solr";;
    private SolrServer solrServer; 
    public SolrJ() {  
        if (solrServer == null) { 
            solrServer = new HttpSolrServer(urlString);  

                }
        }  

public QueryResponse getRueryResponse(String queryString) { 
        SolrQuery query = new SolrQuery();  
        query.setHighlight(true).setHighlightSnippets(20); //set other params as
needed
        query.setParam("hl.fl", "content");
        query.setQuery(queryString);
        query.set("&wt", "xslt");
        query.set("&indent",true);
        query.set("&tr", "example.xsl");


        QueryResponse queryResponse = null;
        try { 
            ((HttpSolrServer) solrServer).setParser(new XMLResponseParser());
            queryResponse = solrServer.query(query);
            } catch (SolrServerException e) {
                e.printStackTrace();  
            }   return queryResponse; 
    }
and in example.xsl media type is  
<xsl:output  media-type="text/html" encoding="UTF-8"/>.

but i am getting an exception
Exception in thread "main"
org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException:
Expected mime type application/xml but got text/html.

So could you please provide any solution to resolve issue.


Thanks,

Venkata Krishna Tolusuri.






--
View this message in context: 
http://lucene.472066.n3.nabble.com/Converting-XML-response-of-Search-query-into-HTML-tp4141456.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to