0
私はsolsonにjsonデータのインデックスを作成しようとしています。 document.addField方法私はjson.toJSONString()そのインデックスを使用している場合、私はちょうどJSONStringにキャストせずにjsonObjectを使用する場合、文字列としてデータをJSON、およびオンJavaインデックスjsonデータto solr
SolrClient solr = new HttpSolrClient.Builder(SOLR_URL).build();
SolrInputDocument document = new SolrInputDocument();
String stringToParse = "{\"id\": \"101\",\"name\": \"Baia Otel\",\"services\":[{\"room_id\":\"1234\",\"service_name\":\"Shuttle\"},{\"room_id\":\"1235\",\"service_name\":\"Accommodation\"}]}";
JSONParser parser = new JSONParser();
try {
JSONObject json = (JSONObject) parser.parse(stringToParse);
document.addField("info", json.toJSONString());
} catch (ParseException e) {
e.printStackTrace();
}
。
document.addField("info",json)
このフィールドにはインデックスが作成されません。
どのようにインデックスを入れ子にするためにsolsonにjsonをインデックスできますか?
コレクションにスキーマを使用しているのか、スキーマレスモードになっていますか? – freedev
スキーマレスモードです。 –