-
Notifications
You must be signed in to change notification settings - Fork 25
DOCSP-49085: Port existing Vector Search page #643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mcmorisi
wants to merge
10
commits into
mongodb:docsp-45382-comp-cvg
Choose a base branch
from
mcmorisi:DOCSP-49085-vector-search
base: docsp-45382-comp-cvg
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f89a51b
DOCSP-49085: Port existing Vector Search page
mcmorisi 74d1d84
Fixes
mcmorisi 6862c2e
Fix
mcmorisi 6e8e615
Additions
mcmorisi 8386b7c
Fix
mcmorisi b1416e0
Fix
mcmorisi ef6bc54
SA feedback
mcmorisi 49c3750
Fix
mcmorisi 9ff16d8
Fixes
mcmorisi ac4efac
Fix
mcmorisi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
source/includes/fundamentals/code-examples/MemorySerialization.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using MongoDB.Bson;Add commentMore actions | ||
using MongoDB.Bson.Serialization.Conventions; | ||
using MongoDB.Driver; | ||
|
||
public class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
// Replace with your connection string | ||
const string uri = "<connection string>"; | ||
|
||
var mongoClient = new MongoClient(uri); | ||
var database = mongoClient.GetDatabase("db"); | ||
var _collection = database.GetCollection<Line>("lines"); | ||
|
||
var line = new Line | ||
{ | ||
X = new Memory<int>(new[] { 1, 2, 3, 4, 5 }), | ||
Y = new ReadOnlyMemory<float>(new[] { 1f, 1.41f, 1.73f, 2f, 2.24f }) | ||
}; | ||
|
||
var filter = Builders<Line>.Filter.Empty; | ||
|
||
var result = _collection.Find(filter).FirstOrDefault().ToJson(); | ||
Console.WriteLine(result); | ||
} | ||
|
||
} | ||
|
||
// start-line-class | ||
public class Line | ||
{ | ||
public ObjectId Id { get; set; } | ||
public Memory<int> X { get; set; } | ||
public ReadOnlyMemory<float> Y { get; set; } | ||
} | ||
// end-line-class |
51 changes: 51 additions & 0 deletions
51
source/includes/fundamentals/code-examples/atlas-vector-search/VectorSearchExamples.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// start-bson-arrays | ||
public class BsonArrayVectors | ||
{ | ||
public BsonArray BsonArrayVector { get; set; } | ||
|
||
public Memory<float> MemoryVector { get; set; } | ||
|
||
public ReadOnlyMemory<float> ReadOnlyMemoryVector { get; set; } | ||
|
||
public float[] FloatArrayVector { get; set; } | ||
} | ||
// end-bson-arrays | ||
|
||
// start-binary-vectors | ||
public class BinaryVectors | ||
{ | ||
public BinaryVectorInt8 ValuesInt8 { get; set; } | ||
|
||
public BinaryVectorPackedBit ValuesPackedBit { get; set; } | ||
|
||
public BinaryVectorFloat32 ValuesFloat { get; set; } | ||
|
||
[BinaryVector(BinaryVectorDataType.Int8)] | ||
public Memory<byte> ValuesByte { get; set; } | ||
|
||
[BinaryVector(BinaryVectorDataType.Float32)] | ||
public float[] ValuesFloat { get; set; } | ||
|
||
} | ||
// end-binary-vectors | ||
|
||
// start-binary-int-float-serialize | ||
[BinaryVector(BinaryVectorDataType.Int8)] | ||
public Memory<byte> ValuesByte { get; set; } | ||
|
||
[BinaryVector(BinaryVectorDataType.Int8)] | ||
public Memory<sbyte> ValuesSByte { get; set; } | ||
|
||
[BinaryVector(BinaryVectorDataType.Float32)] | ||
public float[] ValuesFloat { get; set; } | ||
// end-binary-int-float-serialize | ||
|
||
// start-to-query-vector | ||
var binaryVector = new BinaryVectorInt8(new sbyte[] { 0, 1, 2, 3, 4 }); | ||
|
||
var queryVector = binaryVector.ToQueryVector(); | ||
// end-to-query-vector | ||
|
||
// start-array-query-vector | ||
QueryVector v = new QueryVector(new ReadOnlyMemory<float>([1.2f, 2.3f])); | ||
// end-array-query-vector |
86 changes: 86 additions & 0 deletions
86
source/includes/fundamentals/code-examples/atlas-vector-search/VectorSearchQueryExample.cs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.