1
当我使用solrj添加文档solr时,内容是否被编码?solrj是否对内容进行编码?
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();
因为当我用下面的代码搜索它,我找不到它(其他城镇工作)。
SolrQuery solrQuery = new SolrQuery();
solrQuery.set(CommonParams.WT, "json");
solrQuery.setQuery("Zürich");
QueryResponse rsp = locationSearchServer.query(solrQuery);
return rsp.getBeans(City.class);
我可以在该查询参数自动编码,以UTF-8的调试器看到。
我也添加了UTF-8属性到tomcat http://wiki.apache.org/solr/SolrTomcat#URI_Charset_Config但没有任何效果。
我必须添加编码的内容还是为我做solrj?