|
41 | 41 | - name: Add sample data to database |
42 | 42 | run: mongorestore --archive=sampledata.archive --port=27017 |
43 | 43 |
|
| 44 | + - name: Setup Database (Data & Indexes) |
| 45 | + run: | |
| 46 | + # --------------------------------------------------------- |
| 47 | + # 1. Prepare the Search Index Definition |
| 48 | + # --------------------------------------------------------- |
| 49 | + echo '{ |
| 50 | + "mappings": { |
| 51 | + "dynamic": false, |
| 52 | + "fields": { |
| 53 | + "plot": {"type": "string", "analyzer": "lucene.standard"}, |
| 54 | + "fullplot": {"type": "string", "analyzer": "lucene.standard"}, |
| 55 | + "directors": {"type": "string", "analyzer": "lucene.standard"}, |
| 56 | + "writers": {"type": "string", "analyzer": "lucene.standard"}, |
| 57 | + "cast": {"type": "string", "analyzer": "lucene.standard"} |
| 58 | + } |
| 59 | + } |
| 60 | + }' > search_index.json |
| 61 | +
|
| 62 | + # 3. Create the Search Index |
| 63 | + atlas deployments search indexes create movieSearchIndex \ |
| 64 | + --deploymentName myLocalRs1 \ |
| 65 | + --db sample_mflix \ |
| 66 | + --collection movies \ |
| 67 | + --file search_index.json |
| 68 | +
|
| 69 | + # --------------------------------------------------------- |
| 70 | + # 2. Prepare the Vector Index Definition |
| 71 | + # --------------------------------------------------------- |
| 72 | + echo '{ |
| 73 | + "fields": [ |
| 74 | + { |
| 75 | + "type": "vector", |
| 76 | + "path": "plot_embedding_voyage_3_large", |
| 77 | + "numDimensions": 2048, |
| 78 | + "similarity": "cosine" |
| 79 | + } |
| 80 | + ] |
| 81 | + }' > vector_index.json |
| 82 | +
|
| 83 | + # 4. Create the Vector Index |
| 84 | + atlas deployments search indexes create vector_index \ |
| 85 | + --deploymentName myLocalRs1 \ |
| 86 | + --db sample_mflix \ |
| 87 | + --collection embedded_movies \ |
| 88 | + --type vectorSearch \ |
| 89 | + --file vector_index.json |
| 90 | +
|
| 91 | + # --------------------------------------------------------- |
| 92 | + # 6. Wait for indexes to build |
| 93 | + # --------------------------------------------------------- |
| 94 | + echo "Waiting for indexes to build..." |
| 95 | + sleep 20 |
| 96 | + |
44 | 97 | - name: Set up Python |
45 | 98 | uses: actions/setup-python@v5 |
46 | 99 | with: |
|
0 commit comments