Skip to content

IBX-9846: Describe Embeddings search API - #3029

Merged
dabrt merged 17 commits into
5.0from
IBX-9846
Mar 26, 2026
Merged

dabrt merged 17 commits into
5.0from
IBX-9846

Conversation

@dabrt

@dabrt dabrt commented Jan 30, 2026 •

Copy link
Copy Markdown
Contributor
Question Answer
JIRA Ticket IBX-9846
Versions 4.6, 5.0
Edition All

Describe Embeddings search API

Checklist

  • Text renders correctly
  • Text has been checked with vale
  • Description metadata is up to date
  • PHP code samples have been fixed with PHP CS fixer
  • Added link to this PR in relevant JIRA ticket or code PR

@github-actions

github-actions Bot commented Jan 30, 2026 •

Copy link
Copy Markdown

Comment thread docs/search/embeddings_reference/embeddings_reference.md Outdated
Comment thread docs/search/search_api.md Outdated
Comment thread docs/search/search_api.md Outdated
Comment thread docs/search/search_api.md Outdated
Comment thread docs/search/search_api.md Outdated
Comment thread docs/search/search_api.md Outdated
Comment thread docs/search/search_api.md Outdated
Comment thread docs/search/search_api.md Outdated
Comment thread docs/search/search_api.md Outdated
@dabrt
dabrt requested a review from mikadamczyk February 26, 2026 14:09
Comment thread docs/search/search_api.md Outdated
Comment thread docs/search/search_api.md Outdated
Comment thread docs/search/embeddings_reference/embeddings_reference.md Outdated
Comment thread docs/search/embeddings_reference/embeddings_reference.md Outdated
Comment thread docs/search/search_api.md Outdated
Comment thread docs/search/search_api.md Outdated
Comment thread docs/search/search_api.md Outdated
Comment thread docs/search/search_api.md Outdated
dabrt and others added 2 commits February 27, 2026 16:01
Co-authored-by: Mikolaj Adamczyk <mikadamczyk@gmail.com>
@dabrt
dabrt requested a review from mikadamczyk February 27, 2026 16:12
@mnocon
mnocon requested a review from a team March 5, 2026 16:32
Comment thread code_samples/api/public_php_api/src/Command/FindByTaxonomyEmbeddingCommand.php Outdated
Comment thread docs/search/search_api.md Outdated
Comment thread code_samples/api/public_php_api/src/Command/FindByTaxonomyEmbeddingCommand.php Outdated
Comment thread code_samples/api/public_php_api/src/Service/TaxonomyEmbeddingSearchService.php Outdated
Comment thread docs/search/embeddings_reference/embeddings_reference.md Outdated
Comment thread docs/search/search_api.md
Comment thread docs/search/search_api.md Outdated
Comment thread docs/search/embeddings_reference/embeddings_reference.md Outdated
Comment thread docs/search/embeddings_reference/embeddings_reference.md
Comment thread docs/search/search_api.md Outdated
@dabrt
dabrt requested a review from mnocon March 24, 2026 09:07

@mnocon mnocon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

A couple of nitpicks, but the most important comment is about search engine support - I believe we need to mention Solr 9 explicitly to avoid confusion.

Comment thread docs/search/search_api.md Outdated
Comment thread docs/search/search_api.md Outdated
Comment thread docs/search/search_api.md Outdated
Comment thread docs/search/search_api.md Outdated
Comment thread docs/search/embeddings_reference/embeddings_reference.md Outdated
Comment thread docs/search/embeddings_reference/embeddings_reference.md Outdated
Comment thread docs/search/embeddings_reference/embeddings_reference.md Outdated
Comment thread docs/search/embeddings_reference/embeddings_reference.md Outdated
@dabrt
dabrt requested a review from mnocon March 26, 2026 10:39
@dabrt

dabrt commented Mar 26, 2026

Copy link
Copy Markdown
Contributor Author

@mnocon The checks are coming through, I fixed the highlighting in the code sample, everything looks ready for merge and CP to 4.6

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

code_samples/ change report

Before (on target branch)After (in current PR)

code_samples/api/public_php_api/src/Command/FindByTaxonomyEmbeddingCommand.php


code_samples/api/public_php_api/src/Command/FindByTaxonomyEmbeddingCommand.php

docs/search/search_api.md@395:``` php hl_lines="38-39 41-47 49" 
docs/search/search_api.md@396:[[= include_file('code_samples/api/public_php_api/src/Command/FindByTaxonomyEmbeddingCommand.php') =]]
docs/search/search_api.md@397:```

001⫶<?php
002⫶
003⫶declare(strict_types=1);
004⫶
005⫶namespace App\Command;
006⫶
007⫶use Ibexa\Contracts\Core\Repository\SearchService;
008⫶use Ibexa\Contracts\Core\Repository\Values\Content\EmbeddingQueryBuilder;
009⫶use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\ContentTypeIdentifier;
010⫶use Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchHit;
011⫶use Ibexa\Contracts\Core\Search\Embedding\EmbeddingProviderResolverInterface;
012⫶use Ibexa\Contracts\Taxonomy\Search\Query\Value\TaxonomyEmbedding;
013⫶use Symfony\Component\Console\Attribute\AsCommand;
014⫶use Symfony\Component\Console\Command\Command;
015⫶use Symfony\Component\Console\Input\InputInterface;
016⫶use Symfony\Component\Console\Output\OutputInterface;
017⫶use Symfony\Component\Console\Style\SymfonyStyle;
018⫶
019⫶#[AsCommand(
020⫶ name: 'ibexa:taxonomy:find-by-embedding',
021⫶ description: 'Finds content using a taxonomy embedding query.'
022⫶)]
023⫶final class FindByTaxonomyEmbeddingCommand extends Command
024⫶{
025⫶ public function __construct(
026⫶ private readonly SearchService $searchService,
027⫶ private readonly EmbeddingProviderResolverInterface $embeddingProviderResolver,
028⫶ ) {
029⫶ parent::__construct();
030⫶ }
031⫶
032⫶ protected function execute(
033⫶ InputInterface $input,
034⫶ OutputInterface $output
035⫶ ): int {
036⫶ $io = new SymfonyStyle($input, $output);
037⫶
038❇️ $embeddingProvider = $this->embeddingProviderResolver->resolve();
039❇️ $embedding = $embeddingProvider->getEmbedding('example_content');
040⫶
041❇️ $query = EmbeddingQueryBuilder::create()
042❇️ ->withEmbedding(new TaxonomyEmbedding($embedding))
043❇️ ->setFilter(new ContentTypeIdentifier('article'))
044❇️ ->setLimit(10)
045❇️ ->setOffset(0)
046❇️ ->setPerformCount(true)
047❇️ ->build();
048⫶
049❇️ $result = $this->searchService->findContent($query);
050⫶
051⫶ $io->success(sprintf('Found %d items.', $result->totalCount));
052⫶
053⫶ foreach ($result->searchHits as $searchHit) {
054⫶ assert($searchHit instanceof SearchHit);
055⫶
056⫶ /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */
057⫶ $content = $searchHit->valueObject;
058⫶ $contentInfo = $content->versionInfo->contentInfo;
059⫶
060⫶ $io->writeln(sprintf(
061⫶ '%d: %s',
062⫶ $contentInfo->id,
063⫶ $contentInfo->name
064⫶ ));
065⫶ }
066⫶
067⫶ return self::SUCCESS;
068⫶ }
069⫶}


code_samples/api/public_php_api/src/embedding_fields.php


code_samples/api/public_php_api/src/embedding_fields.php

docs/search/embeddings_reference/embeddings_reference.md@90:``` php
docs/search/embeddings_reference/embeddings_reference.md@91:[[= include_file('code_samples/api/public_php_api/src/embedding_fields.php') =]]
docs/search/embeddings_reference/embeddings_reference.md@92:```

001⫶<?php declare(strict_types=1);
002⫶
003⫶// Create an embedding field using the default embedding provider (type derived from configuration's field suffix)
004⫶
005⫶/** @var Ibexa\Contracts\Core\Search\FieldType\EmbeddingFieldFactory $factory */
006⫶$embeddingField = $factory->create();
007⫶echo $embeddingField->getType(); // for example, "ibexa_dense_vector_model_123"
008⫶
009⫶// Create a custom embedding field with a specific type
010⫶$customField = $factory->create('custom_embedding_type');
011⫶echo $customField->getType(); // "custom_embedding_type"

Download colorized diff

@dabrt
dabrt merged commit bffcce1 into 5.0 Mar 26, 2026
11 checks passed
@dabrt
dabrt deleted the IBX-9846 branch March 26, 2026 12:10
dabrt added a commit that referenced this pull request Mar 26, 2026
* IBX-9846: Describe Embeddings search
---------

Co-authored-by: Mikolaj Adamczyk <mikadamczyk@gmail.com>
Co-authored-by: dabrt <dabrt@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants