You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/search/search_api.md
+45-17Lines changed: 45 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ The service should be [injected into the constructor of your command or controll
19
19
20
20
`SearchService` is also used in the back office of [[= product_name =]], in components such as Universal Discovery Widget or Sub-items List.
21
21
22
-
### Perform a search
22
+
### Perform search
23
23
24
24
To search through content you need to create a [`LocationQuery`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-LocationQuery.html) and provide your Search Criteria as a series of Criterion objects.
25
25
@@ -372,7 +372,7 @@ Instead of comparing keywords, the system compares vectors that represent the se
372
372
!!! note "Taxonomy suggestions"
373
373
374
374
Embedding queries have been introduced primarily to support the [Taxonomy suggestions](taxonomy.md#taxonomy-suggestions) feature but you can use them in other scenarios.
375
-
375
+
376
376
Searching with embeddings can be combined with filtering, which allows the semantic search results to be constrained by content type, location, permissions, or other criteria.
377
377
378
378
An embedding query is represented by the `Ibexa\Contracts\Core\Repository\Values\Content\EmbeddingQuery` value object.
@@ -401,29 +401,57 @@ Embedding queries can also be combined with filters to narrow down results, such
401
401
402
402
```php
403
403
use Ibexa\Contracts\Core\Repository\Values\Content\EmbeddingQueryBuilder;
404
-
use Ibexa\Contracts\Core\Repository\Values\Content\Query\Embedding;
404
+
use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\ContentTypeIdentifier;
405
+
use Ibexa\Contracts\Taxonomy\Search\Query\Value\TaxonomyEmbedding;
405
406
406
-
// Example embedding vector (float[])
407
407
$vector = [
408
-
0.0123,
409
-
-0.9876,
410
-
0.4567,
411
-
// ...
408
+
0.0123,
409
+
-0.9876,
410
+
0.4567,
411
+
...
412
412
];
413
413
414
-
// Create an Embedding instance with a float[] vector
415
-
$embedding = new Embedding($vector);
414
+
$embedding = new TaxonomyEmbedding($vector);
416
415
417
-
// Build the embedding query with the fluent builder
418
416
$embeddingQuery = EmbeddingQueryBuilder::create()
419
-
->withEmbedding($embedding)
420
-
->setLimit(10) // maximum number of results
421
-
->setOffset(0) // result offset for pagination
422
-
->setPerformCount(true) // optionally count total matching items
0 commit comments