Skip to content

Commit

Permalink
[fix][sdk] Fix search parameter being null in brute-force search
Browse files Browse the repository at this point in the history
  • Loading branch information
wt0530 committed Dec 15, 2023
1 parent 82532a3 commit 3e83c81
Showing 1 changed file with 27 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,31 +143,33 @@ public List<VectorWithDistanceResult> 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()))
Expand Down

0 comments on commit 3e83c81

Please sign in to comment.