Skip to content

Commit

Permalink
Merge pull request #838 from AnthonyTsu1984/master
Browse files Browse the repository at this point in the history
Add CSharp SDK Ref 2.2.x
  • Loading branch information
AnthonyTsu1984 authored Sep 11, 2023
2 parents 132b765 + 1b5bba1 commit 2b88270
Show file tree
Hide file tree
Showing 49 changed files with 1,057 additions and 0 deletions.
36 changes: 36 additions & 0 deletions API_Reference/milvus-sdk-csharp/v2.2.x/About.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# About Milvus C# SDK

Milvus C# SDK is an open-source project and its source code is hosted on [GitHub](https://github.com/milvus-io/milvus-sdk-csharp).

## Compatibility

| Nuget version | Branch | Description | Milvus version
| --- | --- | --- | --- |
| v2.2.2 | main | Support grpc only | 2.2.x |
| v2.2.1 | main | Support restfulapi and grpc[**Obsolete**] | 2.2.x |
| v2.2.0 | 2.2 | Support grpc only[**Obsolete**] | 2.2.x |

## Installation

You can use [.NET CLI](https://learn.microsoft.com/en-us/nuget/quickstart/install-and-use-a-package-using-the-dotnet-cli) to install and use the SDK.

```shell
dotnet add package Milvus.Client --version 2.2.2-preview.5
```

## Jupyter Notebooks 📙

You can find Jupyter notebooks in the [docs/notebooks](./docs/notebooks) folder.

[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/milvus-io/milvus-sdk-csharp)

* [00.Settings.ipynb](./docs/notebooks/00.Settings.ipynb)
* [01.Connect to milvus.ipynb](./docs/notebooks/01.Connect%20to%20milvus.ipynb)
* [02.Create a Collection.ipynb](./docs/notebooks/02.Create%20a%20Collection.ipynb)
* [03.Create a Partition.ipynb](./docs/notebooks/03.Create%20a%20Partition.ipynb)
* [04.Insert Vectors.ipynb](./docs/notebooks/04.Insert%20Vectors.ipynb)
* [05.Build an Index on Vectors.ipynb](./docs/notebooks/05.Build%20an%20Index%20on%20Vectors.ipynb)
* [06.Search.ipynb](./docs/notebooks/06.Search.ipynb)
* [07.Query.ipynb](./docs/notebooks/07.Query.ipynb)

> Requirements: C# notebooks require .NET 7 and the VS Code Polyglot extension.
21 changes: 21 additions & 0 deletions API_Reference/milvus-sdk-csharp/v2.2.x/Alias/AlterAliasAsync().md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# AlterAliasAsync()

Alters an alias to point to a new collection.

## Invocation

```c#
await milvusClient.AlterAliasAsync(collectionName, alias, cancellationToken = default);
```

## Parameters

| Parameter | Description | Type | Required |
| ------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------- | -------- |
| `collectionName` | The name of the collection to which the alias should point. | `string` | True |
| `alias` | The alias to be altered. | `string` | True |
| `cancellationToken` | The token to monitor for cancellation requests. The default value is `CancellationToken.None`. | `CancellationToken` | False |

## Return

This method does not return any value.
21 changes: 21 additions & 0 deletions API_Reference/milvus-sdk-csharp/v2.2.x/Alias/CreateAliasAsync().md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# CreateAliasAsync()

Creates an alias for a collection.

## Invocation

```c#
await milvusClient.CreateAliasAsync(collectionName, alias, cancellationToken = default);
```

## Parameters

| Parameter | Description | Type | Required |
| ------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------- | -------- |
| `collectionName` | The name of the collection for which to create the alias. | `string` | True |
| `alias` | The alias to be created. | `string` | True |
| `cancellationToken` | The token to monitor for cancellation requests. The default value is `CancellationToken.None`. | `CancellationToken` | False |

## Return

This method does not return any value.
20 changes: 20 additions & 0 deletions API_Reference/milvus-sdk-csharp/v2.2.x/Alias/DropAliasAsync().md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# DropAliasAsync()

Drops an alias.

## Invocation

```c#
await milvusClient.DropAliasAsync(alias, cancellationToken = default);
```

## Parameters

| Parameter | Description | Type | Required |
| ------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------- | -------- |
| `alias` | The alias to be dropped. | `string` | True |
| `cancellationToken` | The token to monitor for cancellation requests. The default value is `CancellationToken.None`. | `CancellationToken` | False |

## Return

This method does not return any value.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# CompactAsync()

Compacts the collection.

## Invocation

```c#
await collection.CompactAsync(newName, cancellationToken = default);
```

## Parameters

| Parameter | Description | Type | Required |
| ------------------- | ----------------------------------------------------------------------------------------------------------- | ------------------------------- | -------- |
| `cancellationToken` | The token to monitor for cancellation requests. The default value is `CancellationToken.None`. | `CancellationToken` | False |

## Return

The compaction ID.
21 changes: 21 additions & 0 deletions API_Reference/milvus-sdk-csharp/v2.2.x/Collection/DeleteAsync().md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# DeleteAsync()()

Deletes rows from a collection by given expression.

## Invocation

```c#
await collection.DeleteAsync(expression, partitionName = null, cancellationToken = default);
```

## Parameters

| Parameter | Description | Type | Required |
| ------------------- | ----------------------------------------------------------------------------------------------------------- | ------------------------------- | -------- |
| `expression` | A boolean expression determining which rows are to be deleted. | `string` | True |
| `partitionName` | An optional name of a partition from which rows are to be deleted. | `string?` | False |
| `cancellationToken` | The token to monitor for cancellation requests. The default value is `CancellationToken.None`. | `CancellationToken` | False |

## Return

A `MutationResult` containing information about the drop operation.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# DescribeAsync()

Describes a collection, returning information about its configuration and schema.

## Invocation

```c#
await collection.DescribeAsync(cancellationToken = default);
```

## Parameters

| Parameter | Description | Type | Required |
| ------------------- | ----------------------------------------------------------------------------------------------------------- | ------------------------------- | -------- |
| `cancellationToken` | The token to monitor for cancellation requests. The default value is `CancellationToken.None`. | `CancellationToken` | False |

## Return

A description of the collection.
19 changes: 19 additions & 0 deletions API_Reference/milvus-sdk-csharp/v2.2.x/Collection/DropAsync().md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# DropAsync()

Drops a collection.

## Invocation

```c#
await collection.DropAsync(cancellationToken = default);
```

## Parameters

| Parameter | Description | Type | Required |
| ------------------- | ----------------------------------------------------------------------------------------------------------- | ------------------------------- | -------- |
| `cancellationToken` | The token to monitor for cancellation requests. The default value is `CancellationToken.None`. | `CancellationToken` | False |

## Return

This method does not return any value.
20 changes: 20 additions & 0 deletions API_Reference/milvus-sdk-csharp/v2.2.x/Collection/FlushAsync().md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# FlushAsync()

Flushes collection data to disk, required only in order to get up-to-date statistics.
This method will be removed in a future version.

## Invocation

```c#
await collection.FlushAsync(cancellationToken = default);
```

## Parameters

| Parameter | Description | Type | Required |
| ------------------- | ----------------------------------------------------------------------------------------------------------- | ------------------------------- | -------- |
| `cancellationToken` | The token to monitor for cancellation requests. The default value is `CancellationToken.None`. | `CancellationToken` | False |

## Return

A `FlushResult` containing information about the flush operation.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# GetEntityCountAsync()

Retrieves the current number of entities in the collection. Call `FlushAsync` before invoking this method to ensure up-to-date results.

## Invocation

```c#
await collection.GetEntityCountAsync(cancellationToken = default);
```

## Parameters

| Parameter | Description | Type | Required |
| ------------------- | ----------------------------------------------------------------------------------------------------------- | ------------------------------- | -------- |
| `cancellationToken` | The token to monitor for cancellation requests. The default value is `CancellationToken.None`. | `CancellationToken` | False |

## Return

The number of entities currently in the collection.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# GetLoadingProgressAsync()

Returns the loading progress for a collection, and optionally one or more of its partitions.

## Invocation

```c#
await collection.GetLoadingProgressAsync(partitionNames = null, cancellationToken = default);
```

## Parameters

| Parameter | Description | Type | Required |
| ------------------- | ----------------------------------------------------------------------------------------------------------- | ------------------------------- | -------- |
| `partitionNames` | An optional list of partition names for which to check the loading progress. | `IReadOnlyList<string>?` | False |
| `cancellationToken` | The token to monitor for cancellation requests. The default value is <see cref="CancellationToken.None" />. | `CancellationToken` | False |

## Return

The loading progress of the collection.
32 changes: 32 additions & 0 deletions API_Reference/milvus-sdk-csharp/v2.2.x/Collection/InsertAsync().md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# InsertAsync()

Inserts rows of data into a collection.

## Invocation

```c#
await collection.InsertAsync(data, partitionName = null, cancellationToken = default);
```

## Parameters

| Parameter | Description | Type | Required |
| ------------------- | ----------------------------------------------------------------------------------------------------------- | ------------------------------- | -------- |
| `data` | The field data to insert; each field contains a list of row values. | `IReadOnlyList<FieldData>` | True |
| `partitionName` | An optional name of a partition to insert into. | `string?` | False |
| `cancellationToken` | The token to monitor for cancellation requests. The default value is `CancellationToken.None`. | `CancellationToken` | False |

## Return

This method does not return any value.

## Example

```c#
await milvusClient.GetCollection("book").InsertAsync(new FieldData[]
{
FieldData.Create("book_id", bookIds),
FieldData.Create("word_count", wordCounts),
FieldData.CreateFloatVector("book_intro", bookIntros)
});
```
20 changes: 20 additions & 0 deletions API_Reference/milvus-sdk-csharp/v2.2.x/Collection/LoadAsync().md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# LoadAsync()

Loads a collection into memory so that it can be searched or queried.

## Invocation

```c#
await collection.LoadAsync(replicaNumber = null, cancellationToken = default);
```

## Parameters

| Parameter | Description | Type | Required |
| ------------------- | ----------------------------------------------------------------------------------------------------------- | ------------------------------- | -------- |
| `replicaNumber` | An optional replica number to load. | `int?` | False |
| `cancellationToken` | The token to monitor for cancellation requests. The default value is `CancellationToken.None`. | `CancellationToken` | False |

## Return

This method does not return any value.
34 changes: 34 additions & 0 deletions API_Reference/milvus-sdk-csharp/v2.2.x/Collection/QueryAsync().md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# QueryAsync()

Retrieves rows from a collection via scalar filtering based on a boolean expression.

## Invocation

```c#
await collection.QueryAsync(expression, parameters = null, cancellationToken = default);
```

## Parameters

| Parameter | Description | Type | Required |
| ------------------- | ----------------------------------------------------------------------------------------------------------- | ------------------------------- | -------- |
| `expression` | A boolean expression determining which rows are to be returned. | `string` | True |
| `parameters` | Various additional optional parameters to configure the query. | `QueryParameters?` | False |
| `cancellationToken` | The token to monitor for cancellation requests. The default value is `CancellationToken.None`. | `CancellationToken` | False |

## Return

A list of `FieldData` instances with the query results.

## Example

```c#
var results = await Client.GetCollection("book").QueryAsync(
expression: "book_id in [2,4,6,8]",
new QueryParameters
{
Offset = 0,
Limit = 10,
OutputFields = { "book_id", "book_intro" }
});
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# ReleaseAsync()

Releases a collection that has been previously loaded.

## Invocation

```c#
await collection.ReleaseAsync(cancellationToken = default);
```

## Parameters

| Parameter | Description | Type | Required |
| ------------------- | ----------------------------------------------------------------------------------------------------------- | ------------------------------- | -------- |
| `cancellationToken` | The token to monitor for cancellation requests. The default value is `CancellationToken.None`. | `CancellationToken` | False |

## Return

This method does not return any value.
20 changes: 20 additions & 0 deletions API_Reference/milvus-sdk-csharp/v2.2.x/Collection/RenameAsync().md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# RenameAsync()

Renames a collection.

## Invocation

```c#
await collection.RenameAsync(newName, cancellationToken = default);
```

## Parameters

| Parameter | Description | Type | Required |
| ------------------- | ----------------------------------------------------------------------------------------------------------- | ------------------------------- | -------- |
| `newName` | The new collection name. | `string` | True |
| `cancellationToken` | The token to monitor for cancellation requests. The default value is `CancellationToken.None`. | `CancellationToken` | False |

## Return

This method does not return any value.
Loading

0 comments on commit 2b88270

Please sign in to comment.