milvus/sdk
yukun 3e1b2ab4a0
Filtering by numeric scalar fields prototype (#1919)
* Add hybrid request handler

Signed-off-by: fishpenguin <kun.yu@zilliz.com>

* Add C++ sdk for createcollection and insertentities

Signed-off-by: fishpenguin <kun.yu@zilliz.com>

* Add RequestHandler

Signed-off-by: fishpenguin <kun.yu@zilliz.com>

* Add test case for hybrid insert

Signed-off-by: fishpenguin <kun.yu@zilliz.com>

* Fix sqlite bug for createcollection

Signed-off-by: fishpenguin <kun.yu@zilliz.com>

* Add HybridQuery Handler DBImpl and ExecBinaryQuery

Signed-off-by: fishpenguin <kun.yu@zilliz.com>

* Add HybridSearch sdk

Signed-off-by: fishpenguin <kun.yu@zilliz.com>

* Add HybridSearch test case

Signed-off-by: fishpenguin <kun.yu@zilliz.com>

* Fix HybridSearch bug

Signed-off-by: fishpenguin <kun.yu@zilliz.com>

* Fix HybridSearch crash bug

Signed-off-by: fishpenguin <kun.yu@zilliz.com>

* Change void* to vector<uint8_t> in Attr codec

Signed-off-by: fishpenguin <kun.yu@zilliz.com>

* Add context and new search task

Signed-off-by: fishpenguin <kun.yu@zilliz.com>

* Add merge for Hybrid

Signed-off-by: fishpenguin <kun.yu@zilliz.com>

* Add AST validation

Signed-off-by: fishpenguin <kun.yu@zilliz.com>

* Add unittest for hybrid

Signed-off-by: fishpenguin <kun.yu@zilliz.com>

* Fix hybrid search nq bug

Signed-off-by: fishpenguin <kun.yu@zilliz.com>

* Fix bugs after merge master

Signed-off-by: fishpenguin <kun.yu@zilliz.com>

* Fix clang format

Signed-off-by: fishpenguin <kun.yu@zilliz.com>

* Fix unittest bugs

Signed-off-by: fishpenguin <kun.yu@zilliz.com>

* Fix Codacy

Signed-off-by: fishpenguin <kun.yu@zilliz.com>

* Fix compact unittest bug

Signed-off-by: fishpenguin <kun.yu@zilliz.com>

* Remove grpc request in hybridsearchcontext

Signed-off-by: fishpenguin <kun.yu@zilliz.com>

* Fix some codacy quality issue

Signed-off-by: fishpenguin <kun.yu@zilliz.com>

* Fix HYBRID_DB_TEST bug

Signed-off-by: fishpenguin <kun.yu@zilliz.com>

* Annotate new search task

Signed-off-by: fishpenguin <kun.yu@zilliz.com>

* Add Hybrid RPC handler unittest

Signed-off-by: fishpenguin <kun.yu@zilliz.com>

* Fix logs

Signed-off-by: fishpenguin <kun.yu@zilliz.com>

* Add HybridSearch unittest

Signed-off-by: fishpenguin <kun.yu@zilliz.com>
2020-04-16 14:54:12 +08:00
..
build-support Put C++ sdk out of milvus/core (#785) 2019-12-20 14:08:45 +08:00
cmake #1240 Update license declaration of each file (#1241) 2020-02-17 23:40:58 +08:00
examples Filtering by numeric scalar fields prototype (#1919) 2020-04-16 14:54:12 +08:00
grpc Filtering by numeric scalar fields prototype (#1919) 2020-04-16 14:54:12 +08:00
grpc-gen Filtering by numeric scalar fields prototype (#1919) 2020-04-16 14:54:12 +08:00
include Filtering by numeric scalar fields prototype (#1919) 2020-04-16 14:54:12 +08:00
interface Filtering by numeric scalar fields prototype (#1919) 2020-04-16 14:54:12 +08:00
thirdparty/nlohmann merge json to master to get docker image (#1500) 2020-03-07 15:23:34 +08:00
build.sh Put C++ sdk out of milvus/core (#785) 2019-12-20 14:08:45 +08:00
CMakeLists.txt #1240 Update license declaration of each file (#1241) 2020-02-17 23:40:58 +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