milvus/sdk
groot 0f1aa5f8bb Tanimoto distance (#1016)
* Add log to debug #678

* Rename nsg_mix to RNSG in C++ sdk #735

* [skip ci] change __function__

* clang-format

* #766 If partition tag is similar, wrong partition is searched

* #766 If partition tag is similar, wrong partition is searched

* reorder changelog id

* typo

* define interface

* Define interface (#832)

* If partition tag is similar, wrong partition is searched  (#825)

* #766 If partition tag is similar, wrong partition is searched

* #766 If partition tag is similar, wrong partition is searched

* reorder changelog id

* typo

* define interface Attach files by dragging & dropping, selecting or pasting them. 

Co-authored-by: groot <yihua.mo@zilliz.com>

* faiss & knowhere

* faiss & knowhere (#842)

* Add log to debug #678

* Rename nsg_mix to RNSG in C++ sdk #735

* [skip ci] change __function__

* clang-format

* If partition tag is similar, wrong partition is searched  (#825)

* #766 If partition tag is similar, wrong partition is searched

* #766 If partition tag is similar, wrong partition is searched

* reorder changelog id

* typo

* faiss & knowhere

Co-authored-by: groot <yihua.mo@zilliz.com>

* support binary input

* code lint

* add wrapper interface

* add knowhere unittest

* sdk support binary

* support using metric tanimoto and hamming

* sdk binary insert/query example

* fix bug

* fix bug

* update wrapper

* format

* Improve unittest and fix bugs

* delete printresult

* fix bug

* #823 Support binary vector tanimoto metric

* fix typo

* dimension limit to 32768

* fix

* dimension limit to 32768

* fix describe index bug

* fix #886

* fix #889

* add jaccard cases

* hamming dev-test case

* change test_connect

* Add tanimoto cases

* change the output type of hamming

* add abs

* merge master

* rearrange changelog id

* modify feature description

Co-authored-by: Yukikaze-CZR <48198922+Yukikaze-CZR@users.noreply.github.com>
Co-authored-by: Tinkerrr <linxiaojun.cn@outlook.com>
2020-01-14 19:22:27 +08:00
..
build-support Put C++ sdk out of milvus/core (#785) 2019-12-20 14:08:45 +08:00
cmake Remove Jfrog Cache on Jenkins CI (#827) 2019-12-26 10:33:05 +08:00
examples Tanimoto distance (#1016) 2020-01-14 19:22:27 +08:00
grpc Tanimoto distance (#1016) 2020-01-14 19:22:27 +08:00
grpc-gen Tanimoto distance (#1016) 2020-01-14 19:22:27 +08:00
include Tanimoto distance (#1016) 2020-01-14 19:22:27 +08:00
interface Tanimoto distance (#1016) 2020-01-14 19:22:27 +08:00
build.sh Put C++ sdk out of milvus/core (#785) 2019-12-20 14:08:45 +08:00
CMakeLists.txt Put C++ sdk out of milvus/core (#785) 2019-12-20 14:08:45 +08:00
README.md [skip ci] Update C++ SDK readme. (#973) 2020-01-13 13:56:59 +08:00

Milvus C++ SDK

Get C++ SDK

If you compile Milvus from source, C++ SDK is already in [Milvus root path]/sdk. If you install Milvus from Docker images, you need to download the whole sdk folder to your host.

Requirements

CMake 3.14 or higher

Build C++ SDK

You must build the C++ SDK before using it:

 # build C++ SDK
 $ cd [Milvus root path]/sdk
 $ ./build.sh

Try C++ example

You must have a running Milvus server to try the C++ example. Refer to Milvus Documentation to learn how to install and run a Milvus server.

Run C++ example:

# run Milvus C++ example
$ cd [Milvus root path]/sdk/cmake_build/examples/simple
$ ./sdk_simple

Create your own C++ client project

Create a folder for the project, and copy C++ SDK header and library files into it.

 # create project folder
 $ mkdir MyMilvusClient
 $ cd MyMilvusClient
 
 # copy necessary files
 $ cp [Milvus root path]/sdk/cmake_build/libmilvus_sdk.so .
 $ cp [Milvus root path]/sdk/include/MilvusApi.h .
 $ cp [Milvus root path]/sdk/include/Status.h .

Create file main.cpp in the project folder, and copy the following code into it:

#include "./MilvusApi.h"
#include "./Status.h"

int main() {
  // connect to milvus server
  std::shared_ptr<milvus::Connection> conn = milvus::Connection::Create();
  milvus::ConnectParam param = {"127.0.0.1", "19530"};
  conn->Connect(param);
  
  // put your client code here
  
  milvus::Connection::Destroy(conn);
  return 0;
}

Create file CMakeLists.txt in the project folder, and copy the following code into it:

 cmake_minimum_required(VERSION 3.14)
 project(test)
 set(CMAKE_CXX_STANDARD 17)

 add_executable(milvus_client main.cpp)
 target_link_libraries(milvus_client
         ${PROJECT_SOURCE_DIR}/libmilvus_sdk.so
         pthread)

Now there are 5 files in your project:

MyMilvusClient
 |-CMakeLists.txt
 |-main.cpp
 |-libmilvus_sdk.so
 |-MilvusApi.h
 |-Status.h

Build the project:

 $ mkdir cmake_build
 $ cd cmake_build
 $ cmake ..
 $ make

Run your client program:

 $ ./milvus_client