Skip to content

Test vector search - #3433

Closed
touv wants to merge 6 commits into
masterfrom
poc-matric-2
Closed

touv wants to merge 6 commits into
masterfrom
poc-matric-2

Conversation

@touv

@touv touv commented Feb 9, 2026 •

Copy link
Copy Markdown
Contributor
  • Télécharger le fichier CSV du jeu de données "films" (fichier CSV)
  • Importer le modèle joint
  • Lancer le "préclacul"

se contecter à mongo via mongosh :

docker compose exec mongod mongosh

créer l'index 'en modifiant le nom de la collection :

b.pc_6989fedc038484abf6466956.createSearchIndex(
  "vector_index", 
  "vectorSearch", 
  {
    "fields": [
      {
        "type": "vector",
        "path": "value",
        "numDimensions": 384,
        "similarity": "cosine",
        "quantization": "scalar"
      }
    ]
  }
);

choisir une requete vectorisée (en copiant collant une ligne du résultat du "precomputed"

const QUERY_EMBEDDING = [ 
        -0.0640373826026917, 
        0.0258730743080378
        (...)
];

lancer la requete (en modifiant le nom de la collection:

db.pc_6989fedc038484abf6466956.aggregate([
  {
    "$vectorSearch": {
      "index": "vector_index",
      "path": "value",
      "queryVector": QUERY_EMBEDDING,
      "numCandidates": 150,
      "limit": 10
    }
  },
  {
    "$project": {
      "_id": 0,
      "id": 1,
      "score": { $meta: "vectorSearchScore" }
    }
  }
]);

@touv touv added the State / Do Not Merge 👷‍♂️ PR bloquée ne devant pas être intégrée label Feb 9, 2026
@touv
touv marked this pull request as draft February 9, 2026 16:58
@touv

touv commented Feb 9, 2026

Copy link
Copy Markdown
Contributor Author
image le précalcul qui génère le vecteur

@touv

touv commented Feb 9, 2026

Copy link
Copy Markdown
Contributor Author

les vetceurs stockés dans mongo
image

@touv

touv commented Feb 9, 2026

Copy link
Copy Markdown
Contributor Author

la requete qui permet de supprimer l'index

db.runCommand(
   {
      dropSearchIndex: "pc_6989fedc038484abf6466956",
      name: "vector_index"
   }
);

@touv

touv commented Feb 17, 2026

Copy link
Copy Markdown
Contributor Author
image

@touv touv closed this Jul 24, 2026
@touv touv mentioned this pull request Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

State / Do Not Merge 👷‍♂️ PR bloquée ne devant pas être intégrée

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant