Skip to content

Instantly share code, notes, and snippets.

@jamesc127
Created October 4, 2023 04:59
Show Gist options
  • Save jamesc127/a630b40b46d8873407e6e8015cd55d4a to your computer and use it in GitHub Desktop.
Save jamesc127/a630b40b46d8873407e6e8015cd55d4a to your computer and use it in GitHub Desktop.
gist overview of 25-september weekly learning

Hybrid Search Example

Applications can filter users in a geographic area by filtering first on tag information, and then using an ANN query with geospatial vector embeddings

CREATE TABLE users ( 
id UUID PRIMARY KEY, 
state text, 
city int,
tags set<text>,
sem_vec vector<float, 384> 
);

CREATE CUSTOM INDEX ON catalog(tags) USING 'StorageAttachedIndex'
CREATE CUSTOM INDEX ON catalog(sem_vec) USING 'StorageAttachedIndex'

SELECT * FROM users 
WHERE tags CONTAINS 'drink:coffee' 
ORDER BY sem_vec ANN OF [...];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment