Skip to content

Conversation

@bluepal-prasanthi-moparthi
Copy link
Collaborator

No description provided.

@cla-bot cla-bot bot added the cla-signed label Dec 18, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds vector index functionality to the ArangoDB Go driver, enabling efficient similarity searches on high-dimensional embeddings for AI use cases. The feature is available in ArangoDB 3.12.4 and later.

  • Implements EnsureVectorIndex method with comprehensive validation for vector index parameters
  • Adds support for vector-specific metrics (cosine, L2, inner product) and index options including storedValues
  • Includes extensive test coverage for vector index creation, validation, and query execution plans

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
v2/arangodb/collection_indexes.go Defines the EnsureVectorIndex API, VectorIndexType, VectorParams struct, VectorMetric type, and CreateVectorIndexOptions
v2/arangodb/collection_indexes_impl.go Implements vector index creation logic, JSON unmarshaling for vector index responses, and parameter validation
v2/tests/database_collection_indexes_test.go Adds comprehensive test cases for vector index functionality including creation, validation, storedValues, and query plan verification
v2/CHANGELOG.md Documents the addition of the vector index feature
Makefile Adds ENABLE_VECTOR_INDEX environment variable with default value "true"
test/cluster.sh Configures cluster startup to enable experimental vector index feature when ENABLE_VECTOR_INDEX is set

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

// EnsureVectorIndex creates a vector index in the collection, if it does not already exist.
// The index is returned, together with a boolean indicating if the index was newly created (true) or pre-existing (false).
// Available in ArangoDB 3.12.4 and later.
// VectorParams is an obligatory parameter and must contain at least Dimension,Metric and NLists fields.
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation states that NLists is a required field that must be present, but the validation logic treats it as optional (only validates if non-nil). Either update the documentation to reflect that NLists is optional, or make the validation enforce it as required.

Suggested change
// VectorParams is an obligatory parameter and must contain at least Dimension,Metric and NLists fields.
// VectorParams is an obligatory parameter and must contain at least Dimension and Metric fields. NLists is optional.

Copilot uses AI. Check for mistakes.
Comment on lines +543 to +558
t.Run("Create Vector Index", func(t *testing.T) {
idx, created, err := col.EnsureVectorIndex(
ctx,
[]string{"embedding"},
params,
&arangodb.CreateVectorIndexOptions{
Name: utils.NewType("my_vector_index"),
},
)
require.NoError(t, err)
require.True(t, created, "index should be created on first call")
require.Equal(t, arangodb.VectorIndexType, idx.Type)
require.NotNil(t, idx.VectorIndex)
require.Equal(t, dimension, *idx.VectorIndex.Dimension)
require.Equal(t, metric, *idx.VectorIndex.Metric)
})
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first test case "Create Vector Index" creates an index with the name "my_vector_index" but lacks cleanup code to delete it after the test completes. This could cause subsequent test runs to fail if the index already exists. Add a defer statement to clean up the created index, similar to what's done in the "Create the same index again" test case.

Copilot uses AI. Check for mistakes.
}

result := responseVectorIndex{}
fmt.Printf("reqData: %+v", reqData)
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug print statement should be removed before merging to production. This line outputs debug information to stdout which is not appropriate for production code.

Suggested change
fmt.Printf("reqData: %+v", reqData)

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants