use of com.couchbase.client.java.search.result.SearchRowLocations in project couchbase-jvm-clients by couchbase.
the class SearchIntegrationTest method searchIncludeLocations.
@Test
void searchIncludeLocations() throws Throwable {
String docId = UUID.randomUUID().toString();
MutationResult insertResult = collection.insert(docId, mapOf("name", "billy"));
try {
runWithRetry(Duration.ofSeconds(30), () -> {
SearchResult result = cluster.searchQuery(indexName, queryString("billy"), searchOptions().consistentWith(MutationState.from(insertResult.mutationToken().get())).includeLocations(true));
List<SearchRowLocations> locationsList = result.rows().stream().map(SearchRow::locations).filter(opt -> opt.isPresent()).map(Optional::get).collect(toList());
assertTrue(!locationsList.isEmpty());
});
} finally {
collection.remove(docId);
}
}
Aggregations