Doctrine ODM: Support Vector Search index and stage

XMLWordPrintableJSON

    • Type: New Feature
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Doctrine
    • None
    • None
    • PHP Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      Add $vectorSearch stage to Doctrine MongoDB ODM.

      Prototype: https://github.com/GromNaN/symfony-celebrity-lookalike/blob/027426b3a584c278024324b74fde022ec8962a07/src/Doctrine/ODM/MongoDB/Aggregation/VectorSearchStage.php 

      There is a strong relation between the $vectorSearch stage and the Vector Search index. It should be possible to automatically fill the "path" value from the index name, using the document VectorSearch metadata

      ->vectorSearch()
          ->index('faces')
          ->path('descriptionEmbeddings') // could be omitted
          ->numCandidates($limit * 20)
          ->queryVector($face->descriptionEmbeddings)
          ->limit($limit)

      Question: is there a risk of confusion between limit parameter and the $limit stage in the fluent API ?

      We can also create a #[VectorIndex] attribute that extend #[SearchIndex], promoting all the properties as main parameters.

      #[ODM\VectorIndex(
          name: 'descriptions',
          numDimensions: 1024,
          path: 'descriptionEmbeddings',
          similarity: 'euclidean',
          filters: ['packages', 'tags'],
      )]

            Assignee:
            Unassigned
            Reporter:
            Jérôme Tamarelle
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: