When I add a document solr with the use of solrj is the content then encoded?
CommonsHttpSolrServer server = new CommonsHttpSolrServer(
"http://localhost:8080/solr/");
SolrInputDocument doc = new SolrInputDocument();
doc.addField("id", 1);
doc.addField("city", "Zürich");
server.add(doc);
server.commit();
Because when i search for it with the following code I can not find it (other towns work).
SolrQuery solrQuery = new SolrQuery();
solrQuery.set(CommonParams.WT, "json");
solrQuery.setQuery("Zürich");
QueryResponse rsp = locationSearchServer.query(solrQuery);
return rsp.getBeans(City.class);
I can see in the debugger that the query parameter is encoded to UTF-8 automatically.
I have also added the UTF-8 property to tomcat http://wiki.apache.org/solr/SolrTomcat#URI_Charset_Config but with no effect.
Do I have to add the content encoded or does solrj this for me?
The problem is that queries by GET can fail with international characters. Normally this should be solved by the Tomcat-Param, but in my case not.
A solution which works allways is send it as POST