Skip to content

Conversation

@martinschaer
Copy link

@martinschaer martinschaer commented Dec 28, 2025

This PR:

  • adds SurrealDB as al alternative DB for the internal storage
  • adds SurrealDB as a built-in target (supports vector index with HNSW)

Missing:

  • test graph nodes/edges
  • support for full-text search indexes

To run the example examples/text_embedding_surrealdb:

  • Run SurrealDB with: surreal start -u root -p secret
  • Create .env file based on the .env.example

Resulting contents in cocoindex_setup_metadata:

[
	{
		flow_name: 'TextEmbedding',
		id: cocoindex_setup_metadata:TextEmbedding__FlowMetadata__7b8b2cb83a44fca258958d85f88051e474fbcf0d5b0751f05961b3b16df60ee28e4b2e845396151a10ed6ba965c588f2cc97a8bf17f78c30a202e5d154206f76,
		resource_type: 'FlowMetadata',
		staging_changes: [],
		state: {
			features: [
				'fast_fingerprint'
			],
			last_source_id: 1,
			last_target_id: 1,
			sources: {
				documents: {
					key_schema: {
						kind: 'Str'
					},
					keys_schema: [
						{
							kind: 'Str'
						}
					],
					source_id: 1,
					source_kind: 'LocalFile'
				}
			}
		}
	},
	{
		flow_name: 'TextEmbedding',
		id: cocoindex_setup_metadata:TextEmbedding__Target_SurrealDB__56a92c78862a976e7271524fd5587d99a6e4a2880e4b8fd4cd93bdb6efa77f4001f902f1799d87650e8cc078f29304a95126e9e497af691d441dcb7f9e2d5d7e,
		key: {
			connection: {
				key: 'SurrealDBConnection'
			},
			table_name: 'Chunk'
		},
		resource_type: 'Target:SurrealDB',
		staging_changes: [],
		state: {
			common: {
				key_type: [
					{
						kind: 'Str'
					},
					{
						kind: 'Range'
					}
				],
				max_schema_version_id: 1,
				schema_version_id: 1,
				setup_by_user: false,
				target_id: 1
			},
			state: {
				vector_indexes: {
					embedding: {
						field_name: 'embedding',
						field_type: 'F32',
						metric: 'CosineSimilarity',
						vector_size: 1536
					}
				}
			}
		}
	},
	{
		flow_name: 'TextEmbedding',
		id: cocoindex_setup_metadata:TextEmbedding__TrackingTable__7b8b2cb83a44fca258958d85f88051e474fbcf0d5b0751f05961b3b16df60ee28e4b2e845396151a10ed6ba965c588f2cc97a8bf17f78c30a202e5d154206f76,
		resource_type: 'TrackingTable',
		staging_changes: [],
		state: {
			has_fast_fingerprint_column: true,
			table_name: 'TextEmbedding__cocoindex_tracking',
			version_id: 1
		}
	},
	{
		flow_name: 'TextEmbedding',
		id: cocoindex_setup_metadata:TextEmbedding____FlowVersion__7b8b2cb83a44fca258958d85f88051e474fbcf0d5b0751f05961b3b16df60ee28e4b2e845396151a10ed6ba965c588f2cc97a8bf17f78c30a202e5d154206f76,
		resource_type: '__FlowVersion',
		staging_changes: [],
		state: 1
	}
]
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant