Skip to content

RDoc-3336 Show how to customize the vector field in a static index using a builder #2037

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ public Products_ByVector_Text()
VectorFromText = CreateVector(product.Name)
};

// Customize the vector field options:
// You can customize the vector field using EITHER of the following syntaxes:
// ==========================================================================

// Customize using VectorOptions:
VectorIndexes.Add(x => x.VectorFromText,
new VectorOptions()
{
Expand All @@ -53,6 +56,14 @@ public Products_ByVector_Text()
// Optionally, set the number of candidates
NumberOfCandidatesForIndexing = 20
});

// OR - Customize using builder:
Vector(x=>x.VectorFromText,
builder => builder
.SourceEmbedding(VectorEmbeddingType.Text)
.DestinationEmbedding(VectorEmbeddingType.Single)
.NumberOfEdges(20)
.NumberOfCandidates(20));

// The index MUST use the Corax search engine
SearchEngineType = Raven.Client.Documents.Indexes.SearchEngineType.Corax;
Expand Down Expand Up @@ -113,7 +124,7 @@ public Movies_ByVector_Single()
VectorFromSingle = CreateVector(movie.TagsEmbeddedAsSingle)
};

// Customize the vector field options:
// EITHER - Customize the vector field using VectorOptions:
VectorIndexes.Add(x => x.VectorFromSingle,
new VectorOptions()
{
Expand All @@ -131,6 +142,15 @@ public Movies_ByVector_Single()
NumberOfEdges = 20,
NumberOfCandidatesForIndexing = 20
});

// OR - Customize the vector field using builder:
Vector(x => x.VectorFromSingle,
builder => builder
.SourceEmbedding(VectorEmbeddingType.Single)
.DestinationEmbedding(VectorEmbeddingType.Single)
.Dimensions(2)
.NumberOfEdges(20)
.NumberOfCandidates(20));

// The index MUST use the Corax search engine
SearchEngineType = Raven.Client.Documents.Indexes.SearchEngineType.Corax;
Expand Down Expand Up @@ -192,7 +212,7 @@ public Movies_ByVector_Int8()
VectorFromInt8Arrays = CreateVector(movie.TagsEmbeddedAsInt8)
};

// Customize the vector field options:
// EITHER - Customize the vector field using VectorOptions:
VectorIndexes.Add(x => x.VectorFromInt8Arrays,
new VectorOptions()
{
Expand All @@ -210,6 +230,15 @@ public Movies_ByVector_Int8()
NumberOfEdges = 20,
NumberOfCandidatesForIndexing = 20
});

// OR - Customize the vector field using builder:
Vector(x => x.VectorFromInt8Arrays,
builder => builder
.SourceEmbedding(VectorEmbeddingType.Int8)
.DestinationEmbedding(VectorEmbeddingType.Int8)
.Dimensions(2)
.NumberOfEdges(20)
.NumberOfCandidates(20));

// The index MUST use the Corax search engine
SearchEngineType = Raven.Client.Documents.Indexes.SearchEngineType.Corax;
Expand Down
Loading