isZilliz check in MilvusV2 is not correct

Created on 17 September 2024, 3 days ago
Updated 20 September 2024, about 18 hours ago

Problem/Motivation

/**
   * Check if we are running on zilliz.
   *
   * @return bool
   *   If we are running on zilliz.
   */
  public function isZilliz(): bool {
    // The base url could either contain zillizcloud.com or cloud.zilliz.com.
    return preg_match('(zillizcloud.com|cloud.zilliz.com)', $this->baseUrl) !== FALSE;
  }

preg_match returns 1 if the pattern matches given subject, 0 if it does not, or FALSE if an error occurred.
So FALSE is returned only on error. If pattern is not found it will return 0, but it doesn’t equal to FALSE and isZilliz() always returns TRUE even it the baseUrl doesn't contain zillizcloud.com or cloud.zilliz.com.

Steps to reproduce

Try to use local Milvus server and use database name that is not default.

Proposed resolution

Change the check to:

/**
   * Check if we are running on zilliz.
   *
   * @return bool
   *   If we are running on zilliz.
   */
  public function isZilliz(): bool {
    // The base url could either contain zillizcloud.com or cloud.zilliz.com.
    return preg_match('(zillizcloud.com|cloud.zilliz.com)', $this->baseUrl);
  }

Remaining tasks

Create patch/MR.

User interface changes

None.

API changes

None.

Data model changes

None.

πŸ› Bug report
Status

Fixed

Version

1.0

Component

AI Search

Created by

πŸ‡©πŸ‡ͺGermany a.dmitriiev

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024