mirror of
https://github.com/qdrant/landing_page.git
synced 2026-09-30 16:38:31 +02:00
docs: Query API snippets with Java (#1103)
This commit is contained in:
@@ -332,20 +332,18 @@ dbg!(search_result);
|
||||
import java.util.List;
|
||||
|
||||
import io.qdrant.client.grpc.Points.ScoredPoint;
|
||||
import io.qdrant.client.grpc.Points.SearchPoints;
|
||||
import io.qdrant.client.grpc.Points.QueryPoints;
|
||||
|
||||
import static io.qdrant.client.WithPayloadSelectorFactory.enable;
|
||||
import static io.qdrant.client.QueryFactory.nearest;
|
||||
|
||||
List<ScoredPoint> searchResult =
|
||||
client
|
||||
.searchAsync(
|
||||
SearchPoints.newBuilder()
|
||||
client.queryAsync(QueryPoints.newBuilder()
|
||||
.setCollectionName("test_collection")
|
||||
.setLimit(3)
|
||||
.addAllVector(List.of(0.2f, 0.1f, 0.9f, 0.7f))
|
||||
.setQuery(nearest(0.2f, 0.1f, 0.9f, 0.7f))
|
||||
.setWithPayload(enable(true))
|
||||
.build())
|
||||
.get();
|
||||
.build()).get();
|
||||
|
||||
System.out.println(searchResult);
|
||||
```
|
||||
@@ -444,16 +442,13 @@ dbg!(search_result);
|
||||
import static io.qdrant.client.ConditionFactory.matchKeyword;
|
||||
|
||||
List<ScoredPoint> searchResult =
|
||||
client
|
||||
.searchAsync(
|
||||
SearchPoints.newBuilder()
|
||||
client.queryAsync(QueryPoints.newBuilder()
|
||||
.setCollectionName("test_collection")
|
||||
.setLimit(3)
|
||||
.setFilter(Filter.newBuilder().addMust(matchKeyword("city", "London")))
|
||||
.addAllVector(List.of(0.2f, 0.1f, 0.9f, 0.7f))
|
||||
.setQuery(nearest(0.2f, 0.1f, 0.9f, 0.7f))
|
||||
.setWithPayload(enable(true))
|
||||
.build())
|
||||
.get();
|
||||
.build()).get();
|
||||
|
||||
System.out.println(searchResult);
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user