Iterable<Representation> updatedIterable = yard.update(Arrays.asList(test1, test2, test3));
assertNotNull(updatedIterable);
// Perform a first similarity query that looks a lot like the first document
FieldQuery query = yard.getQueryFactory().createFieldQuery();
query.setConstraint(similarityfield, new SimilarityConstraint("aaaa aaaa aaaa aaaa zzzz yyyy"));
QueryResultList<Representation> results = yard.find(query);
assertEquals(2, results.size());
Iterator<Representation> it = results.iterator();
Representation first = it.next();
assertEquals("urn:yard.test.testFieldQueryWithSimilarityConstraint:representation.id1", first.getId());
// assertEquals(0.99, first.getFirst("http://www.iks-project.eu/ontology/rick/query/score"));
Representation second = it.next();
assertEquals("urn:yard.test.testFieldQueryWithSimilarityConstraint:representation.id2",
second.getId());
// assertEquals(0.80, first.getFirst("http://www.iks-project.eu/ontology/rick/query/score"));
// combine similarity with traditional filtering
query = yard.getQueryFactory().createFieldQuery();
query.setConstraint(similarityfield, new SimilarityConstraint("aaaa aaaa aaaa aaaa zzzz yyyy"));
query.setConstraint(filterfield, new TextConstraint(Arrays.asList("other")));
results = yard.find(query);
assertEquals(1, results.size());
it = results.iterator();
first = it.next();
assertEquals("urn:yard.test.testFieldQueryWithSimilarityConstraint:representation.id2", first.getId());