From 3e83c819cd8a7293f6aaf471e6dec5b52d834b62 Mon Sep 17 00:00:00 2001 From: Tao Wang <18234030530@163.com> Date: Fri, 15 Dec 2023 11:49:25 +0800 Subject: [PATCH] [fix][sdk] Fix search parameter being null in brute-force search --- .../sdk/service/index/IndexServiceClient.java | 52 ++++++++++--------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/java/dingo-sdk/src/main/java/io/dingodb/sdk/service/index/IndexServiceClient.java b/java/dingo-sdk/src/main/java/io/dingodb/sdk/service/index/IndexServiceClient.java index 9096b9973..08460e8ec 100644 --- a/java/dingo-sdk/src/main/java/io/dingodb/sdk/service/index/IndexServiceClient.java +++ b/java/dingo-sdk/src/main/java/io/dingodb/sdk/service/index/IndexServiceClient.java @@ -143,31 +143,33 @@ public List vectorSearch( if (parameter.getVectorFilterType() != null) { builder.setVectorFilterType(Common.VectorFilterType.valueOf(parameter.getVectorFilterType().name())); } - if (search.getFlat() != null) { - builder.setFlat(Common.SearchFlatParam.newBuilder() - .setParallelOnQueries(search.getFlat().getParallelOnQueries()) - .build()); - } - if (search.getIvfFlatParam() != null) { - builder.setIvfFlat(Common.SearchIvfFlatParam.newBuilder() - .setNprobe(search.getIvfFlatParam().getNprobe()) - .setParallelOnQueries(search.getIvfFlatParam().getParallelOnQueries()) - .build()); - } - if (search.getIvfPqParam() != null) { - builder.setIvfPq(Common.SearchIvfPqParam.newBuilder() - .setNprobe(search.getIvfPqParam().getNprobe()) - .setParallelOnQueries(search.getIvfPqParam().getParallelOnQueries()) - .setRecallNum(search.getIvfPqParam().getRecallNum()) - .build()); - } - if (search.getHnswParam() != null) { - builder.setHnsw(Common.SearchHNSWParam.newBuilder() - .setEfSearch(search.getHnswParam().getEfSearch()) - .build()); - } - if (search.getDiskAnnParam() != null) { - + if (search != null) { + if (search.getFlat() != null) { + builder.setFlat(Common.SearchFlatParam.newBuilder() + .setParallelOnQueries(search.getFlat().getParallelOnQueries()) + .build()); + } + if (search.getIvfFlatParam() != null) { + builder.setIvfFlat(Common.SearchIvfFlatParam.newBuilder() + .setNprobe(search.getIvfFlatParam().getNprobe()) + .setParallelOnQueries(search.getIvfFlatParam().getParallelOnQueries()) + .build()); + } + if (search.getIvfPqParam() != null) { + builder.setIvfPq(Common.SearchIvfPqParam.newBuilder() + .setNprobe(search.getIvfPqParam().getNprobe()) + .setParallelOnQueries(search.getIvfPqParam().getParallelOnQueries()) + .setRecallNum(search.getIvfPqParam().getRecallNum()) + .build()); + } + if (search.getHnswParam() != null) { + builder.setHnsw(Common.SearchHNSWParam.newBuilder() + .setEfSearch(search.getHnswParam().getEfSearch()) + .build()); + } + if (search.getDiskAnnParam() != null) { + + } } Index.VectorSearchRequest.Builder reqBuilder = Index.VectorSearchRequest.newBuilder() .addAllVectorWithIds(vectors.stream().map(EntityConversion::mapping).collect(Collectors.toList()))