Skip to content

[Bug]: Search results output fields are "undefined" in nodeJS when results are filtered #419

@Nulhiedbriks

Description

@Nulhiedbriks

Is there an existing issue for this?

  • I have searched the existing issues

Environment

- Milvus version: 2.5.7
- Deployment mode(standalone or cluster): standalone
- MQ type(rocksmq, pulsar or kafka): ?
- SDK version(e.g. pymilvus v2.0.0rc2): @zilliz/milvus2-sdk-node@2.5.6
- OS(Ubuntu or CentOS): Almalinux 9.5
- CPU/Memory: Intel(R) Xeon(R) CPU E3-1230 v6 @ 3.50GHz / 16Gb memory
- GPU: No
- Others:

Current Behavior

I think the problem is : when results are not the same length as input length the results output fields are "undefined".

I work in nodeJs :

options = {
 "anns_field" : "person_vector",
 "collection_name" : "person",
 "consistency_level" : "Eventually",
 "data" : [{sparse_vector1}, {sparse_vector2}, ...], // data.length = 100
 "filter" : "field != 'filter1' and ....", // basics filter with "and" conditions
 "limit" : 5,
 "output_fields" : ["id", "field1", "field2"],
 "timeout" : 120000,
 "topk" : 5
};

// CASE 1 - The request is :  Return 5 nearest records for each of the 100 input within filter conditions. 
options.params = {"metric_type" : "IP",},  // Normalized sparse vector return score in [0;1]. 
const r = await client.search(options);

//// 1.a - 0 record match the filter conditions 

// The result is an Array of size 0. 
console.log(r.results) // Output []

//// 1.b - 1+ records match filter condition

// The result is an Array of size 100 (data.length)
console.log(r.results) // Output [ [match1, ..., matchN], ...] 

// Case 2 - The request is :  Return 5 nearest records for each of the 100 input within filter conditions and score conditions
options.params = {"metric_type" : "IP", radius : 0.9, range_filter : 1},  // Normalized sparse vector return score in [0;1]. 
const r = await client.search(options);

//// 2.a - 0 record match the filter conditions 

// The result is an Array of size 0. 
console.log(r.results) // Output []

//// 2.b - 1+ records match filter condition but not score conditions
// The result is an Array of size N  where N is the number of data that has at least one match with filter and score conditions
console.log(r.results) // Output [ [match1, ..., matchN], , , , ...]  match1 = {score: 0.9283647537231445, id: undefined, field1: undefined, field2: undefined}

Here 2 problems :

  • Results should be an array of length equals the input data length (If i request a search on 100 vectors, results should return an array of size 100 (where each index can be undefined or a sub array))
  • When 1+ records has 0 match due to conditions (filter + score) AND 1+ records has 1+ matches, the results is an Array of size N where N is equals to the number of input data length that has at least 1 match. In that case the output fields are undefined.

Here a solution :

  • Always return an Array of size of the input length and for each index an Array of match (Empty Array if no match ?)
    I think undefined is not correct because in fact the results is "There is no record that match the conditions provides" Returning undefined is more like "I don't understand the request" Or "The request is not valid"

I'm not sure if i'm clear or not (i have a bad english)

Expected Behavior

No response

Steps To Reproduce

Milvus Log

No response

Anything else?

No response

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions