-
Notifications
You must be signed in to change notification settings - Fork 3
Send empty vector index type on Weaviate 1.37.5 #341
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
Show all changes
15 commits
Select commit
Hold shift + click to select a range
b2f2874
Send empty vector index type on Weaviate 1.37.5+
mpartipilo be6bf21
Fix vector index type defaulting bugs surfaced by integration tests
mpartipilo 6dc3dcb
Make integration test version-aware via WEAVIATE_VERSION
mpartipilo 6bc72bc
Bump CI 1.37 matrix entry to 1.37.5-e0fe0d5.amd64
mpartipilo 8657ca7
Drive integration test DEFAULT_VECTOR_INDEX via env var
mpartipilo d70f004
Require WEAVIATE_VERSION env var in default-vector-index integration …
mpartipilo 5293434
Scope DEFAULT_VECTOR_INDEX to integration test job instead of global env
mpartipilo 48d4252
Inject legacy hnsw default in AddVector path for servers < 1.37.5
mpartipilo a2545bd
Remove MaxWorkers and AliveNodesCheckingFrequency from ReplicationAsy…
mpartipilo 84bbce0
Remove maxWorkers and aliveNodesCheckingFrequency from OpenAPI spec a…
mpartipilo 5858526
Add changelog entry for MaxWorkers/AliveNodesCheckingFrequency removal
mpartipilo b9d8ec0
Pass WEAVIATE_VERSION to all test steps via job-level env
mpartipilo a70d627
Add InjectLegacyVectorIndexDefault check to Update method and simplif…
mpartipilo 972873d
Fix integration tests: explicitly set HNSW index for tests that asser…
mpartipilo 668d23e
Increase timeout for flaky batch test in CI
mpartipilo 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
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
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
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
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
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
88 changes: 88 additions & 0 deletions
88
src/Weaviate.Client.Tests/Integration/DefaultVectorIndexTypeIntegrationTests.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,88 @@ | ||
| using Weaviate.Client.Models; | ||
| using Weaviate.Client.Tests.Common; | ||
|
|
||
| namespace Weaviate.Client.Tests.Integration; | ||
|
|
||
| /// <summary> | ||
| /// End-to-end coverage for default vector index behavior across server versions. | ||
| /// Assertions rely on the connected server version reported by the test client. | ||
| /// </summary> | ||
| [Collection("DefaultVectorIndexTypeIntegrationTests")] | ||
| public sealed class DefaultVectorIndexTypeIntegrationTests : IntegrationTests | ||
| { | ||
| private const string DefaultVectorIndexEnvVar = "DEFAULT_VECTOR_INDEX"; | ||
| private const string DefaultVectorIndexFallback = "hfresh"; | ||
| private static readonly Version ServerDefaultCutoff = Version.Parse( | ||
| ServerVersions.DefaultVectorIndexTypeServerSide | ||
| ); | ||
|
|
||
| private string ExpectedDefaultIndexType() | ||
| { | ||
| Assert.NotNull(_weaviate.WeaviateVersion); | ||
|
|
||
| var defaultVectorIndex = Environment.GetEnvironmentVariable(DefaultVectorIndexEnvVar); | ||
| if (string.IsNullOrWhiteSpace(defaultVectorIndex)) | ||
| { | ||
| defaultVectorIndex = DefaultVectorIndexFallback; | ||
| } | ||
|
|
||
| return _weaviate.WeaviateVersion! >= ServerDefaultCutoff | ||
| ? defaultVectorIndex | ||
| : VectorIndex.HNSW.TypeValue; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Scenario A on the named-vector path: user omits <c>VectorIndexType</c> | ||
| /// when configuring a named vector. | ||
| /// <list type="bullet"> | ||
| /// <item>1.37.5+: server applies <c>DEFAULT_VECTOR_INDEX</c> from the | ||
| /// host env var (default <see cref="DefaultVectorIndexFallback"/>).</item> | ||
| /// <item>Older: client injects <c>"hnsw"</c> and server stores it.</item> | ||
| /// </list> | ||
| /// </summary> | ||
| [Fact] | ||
| public async Task NamedVector_NoIndexType_GetsServerOrInjectedDefault() | ||
| { | ||
| var create = new CollectionCreateParams | ||
| { | ||
| Name = MakeUniqueCollectionName( | ||
| nameof(NamedVector_NoIndexType_GetsServerOrInjectedDefault) | ||
| ), | ||
| Properties = [Property.Text("title")], | ||
| VectorConfig = Configure.Vector("default", v => v.SelfProvided(), index: null), | ||
| }; | ||
|
|
||
| var collection = await CollectionFactory<object>(create); | ||
| var config = await collection.Config.Get(TestContext.Current.CancellationToken); | ||
| Assert.NotNull(config.VectorConfig); | ||
| Assert.True(config.VectorConfig.ContainsKey("default")); | ||
| Assert.Equal(ExpectedDefaultIndexType(), config.VectorConfig["default"].VectorIndexType); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Scenario B on the named-vector path: user explicitly configures | ||
| /// <c>VectorIndex.Flat</c>. Must round-trip as <c>"flat"</c> on every | ||
| /// server version — the inject helper must never overwrite an explicit | ||
| /// value. | ||
| /// </summary> | ||
| [Fact] | ||
| public async Task NamedVector_ExplicitFlat_IsPreserved() | ||
| { | ||
| var create = new CollectionCreateParams | ||
| { | ||
| Name = MakeUniqueCollectionName(nameof(NamedVector_ExplicitFlat_IsPreserved)), | ||
| Properties = [Property.Text("title")], | ||
| VectorConfig = Configure.Vector( | ||
| "default", | ||
| v => v.SelfProvided(), | ||
| index: new VectorIndex.Flat() | ||
| ), | ||
| }; | ||
|
|
||
| var collection = await CollectionFactory<object>(create); | ||
| var config = await collection.Config.Get(TestContext.Current.CancellationToken); | ||
| Assert.NotNull(config.VectorConfig); | ||
| Assert.True(config.VectorConfig.ContainsKey("default")); | ||
| Assert.Equal(VectorIndex.Flat.TypeValue, config.VectorConfig["default"].VectorIndexType); | ||
| } | ||
| } |
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
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this also need to be removed from
PublicAPI.Shipped.txt?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, when the release is cut