私は現在、MarkLogic POJOデータバインディングインターフェイスを使用しています。 POJOをMarkLogicに書くことができます。今私はそれらのPOJOを検索し、検索結果を取得したいと思います。私は以下の指示に従っています:https://docs.marklogic.com/guide/java/binding#id_89573しかし、検索結果は正しいオブジェクトを返すようには見えません。私はJSONMappingExceptionを取得しています。MarkLogic POJOデータバインディングインターフェイス:POJO検索を実行する際のJSONMappingException
HashMap<String, MatchedPropertyInfo> matchedProperties = new HashMap<String, MatchedPropertyInfo>();
PropertyMatches PM = new PropertyMatches(123,"uri/prefix/location2", "uri/prefix", 1234,0,"/aKey","/aLocation",true,matchedProperties);
MatchedPropertyInfo MPI1 = new MatchedPropertyInfo("matched/property/uri1", "matched/property/key1", "matched/property/location1", true,"ValueMatch1", 12, 1*1.0/3, true);
MatchedPropertyInfo MPI2 = new MatchedPropertyInfo("matched/property/uri2", "matched/property/key2", "matched/property/location2", true,"ValueMatch2", 14, 1.0/2.0, true);
PM.getMatchedProperties().put("matched/property/prefix/location1", MPI1);
PM.getMatchedProperties().put("matched/property/prefix/location2", MPI2);
PojoRepository myClassRepo = client.newPojoRepository(PropertyMatches.class, Long.class);
myClassRepo.write(PM);
PojoQueryBuilder qb = myClassRepo.getQueryBuilder();
PojoPage<PropertyMatches> matches = myClassRepo.search(qb.value("uri", "uri/prefix/location2"),1);
if (matches.hasContent()) {
while (matches.hasNext()) {
PropertyMatches aPM = matches.next();
System.out.println(" " + aPM.getURI());
}
} else {
System.out.println(" No matches");
}
PropertyMatches(PM)オブジェクトは、MarkLogicデータベースに正常に書き込まれています。このクラスには、というメンバーが含まれており、これは"uri/prefix/location2"
で始まります。上記の例ではmatches.hasContent()
がtrueを返します。ただし、エラーが発生しますPropertyMatches aPM = matches.next();