Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9024131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:55:51+00:00 2026-06-16T05:55:51+00:00

I have a Solr 4.0, which indexes data (which contains multilingual characters) in Postgres

  • 0

I have a Solr 4.0, which indexes data (which contains multilingual characters) in Postgres db. When I’m doing direct request to Solr through built-in Jetty, I get the correct response in form of JSON. There is a Servlet running under Tomcat 7, which is responsible for handling request to the public API. This API gets requests via HTTP, does some sort of check for the rights for doing request and then doing request to Solr using solrj and then sends the response as JSON. The problem is when I’m requesting Solr through the Servlet I always get many ????????? symbols on the places where international characters should be. All the data in DB is in UTF-8 encoding, the URIEncoding parameter in server.xml for Tomcat is UTF-8 too. This is the way I’m writing response in the Servlet:

public void service(HttpServletRequest req, HttpServletResponse res) throws IOException
{
    PrintWriter writer = res.getWriter();
    String encoding = req.getCharacterEncoding();
    if(null == encoding)
    {
        req.setCharacterEncoding("UTF-8");
    }
    else
    {
        req.setCharacterEncoding(encoding);
    }   
    res.setContentType("application/json; charset=UTF-8");
    res.setCharacterEncoding("UTF-8");
    String key = req.getParameter(P_KEY);
    if (ps.isPartnerKey(key))
    {
        if (req.getMethod().equals(M_GET))
        {
            String query = req.getParameter(P_QUERY);
            String solr_json = SolrService.getInstance().query(query);
            //parse JSON for id's and get images
            if (solr_json != null)
            {
                writer.println(solr_json);
            }
        }
        if (req.getMethod().equals(M_POST))
        {
            String id = req.getParameter(P_ID);
            String field = req.getParameter(P_FIELD);
            String value = req.getParameter(P_VALUE);
            SolrService.getInstance().partialUpdate(id, field, value);
            fs.add(id, field, value, ps.getPartnerId(key));
        }
    }
    else
    {
        res.sendError(HttpServletResponse.SC_FORBIDDEN);
    }
    writer.close();
}

And this is how I’m getting data from Solr:

 public String query(String query)
{
    SolrQuery solrQuery = new SolrQuery();
    solrQuery.set("q", query!=null ? query : "*:*");
    solrQuery.set("wt", "json");
    String response = "";
    try
    {
        QueryResponse res = solr.query(solrQuery);
        response = res.getResults().toString();
        log.debug(response);
    }
    catch (SolrServerException e)
    {
        e.printStackTrace();
    }
    return response;
}

Am I doing wrong something? What is the problem may be?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T05:55:52+00:00Added an answer on June 16, 2026 at 5:55 am

    You are calling getWriter to early. Call it after setting the character encoding.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Apache Solr to index my data, I have blob field which
I have a Solr instance which contains documents that represent products. Each document has
I have a Solr schema which contains a location field (using the default solr.LatLonType
I have written a script that gets data from solr for which date is
I am using solr with replication. I have one master that indexes data and
I have an existing solr core which has data in it regarding info on
I am running Solr on my windows machine using jetty. I have downloaded the
I have within my SOLR index song objects which belong to a higher level
I am new to solr. I have developed a an website which uses solr
I have a solr server, which runs into performance issue at random. The queries

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.