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
You can also search through Trash items and sort the results using several public PHP API Search Criteria and Sort Clauses that have been exposed for `TrashService` queries.
125
-
For more information, see [Searching in trash](search_api.md#searching-in-trash).
125
+
For more information, see [Search in trash](search_api.md#search-in-trash).
Copy file name to clipboardExpand all lines: docs/release_notes/ez_platform_v3.1.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -122,7 +122,7 @@ A customizable search controller has been extracted and placed in `ezplatform-se
122
122
123
123
You can now search through the contents of Trash and sort the search results based on a number of Search Criteria and Sort Clauses that can be used by the `\eZ\Publish\API\Repository\TrashService::findTrashItems` method only.
124
124
125
-
For more information, see [Searching in trash](https://doc.ibexa.co/en/latest/api/public_php_api_search/#searching-in-trash).
125
+
For more information, see [Search in trash](https://doc.ibexa.co/en/latest/api/public_php_api_search/#search-in-trash).
description: Embedding queries, embedding configuration, providers, and embedding search fields
4
+
---
5
+
6
+
# Embeddings search reference
7
+
8
+
Embeddings provide vector representations of content or text, enabling [semantic similarity search](search_api.md#search-with-embeddings).
9
+
Foundational abstractions are provided for embedding-based search, while embedding providers generate vector representations.
10
+
11
+
Searching with embeddings is designed for use with the [Taxonomy suggestions](taxonomy.md#taxonomy-suggestions) feature.
12
+
The [`Ibexa\Contracts\Taxonomy\Search\Query\Value\TaxonomyEmbedding`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Taxonomy-Search-Query-Value-TaxonomyEmbedding.html) class allows embedding queries to target taxonomy data.
13
+
14
+
!!! note "Feature support"
15
+
16
+
Searching with embeddings requires a search engine that supports it, such as Elasticsearch or Solr 9.8.1+.
17
+
18
+
## Core query objects
19
+
20
+
### EmbeddingQuery
21
+
22
+
-[`Ibexa\Contracts\Core\Repository\Values\Content\EmbeddingQuery`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-EmbeddingQuery.html) represents a semantic similarity search request.
23
+
It encapsulates an [Embedding](#embedding) instance and supports pagination, aggregations, and result counting through the same API as standard content queries.
24
+
25
+
!!! note "Embedding query properties"
26
+
27
+
Embedding queries do not use criteria for similarity, but for additional filtering applied through the query filter.
28
+
Also, embedding queries do not allow standard Query properties supported by [search engines](search_engines.md) other than the Legacy Search, such as `query`, `sortClauses`, or `spellcheck`.
29
+
30
+
-[EmbeddingQueryBuilder](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-EmbeddingQueryBuilder.html) is a builder for constructing `EmbeddingQuery` instances.
31
+
It helps construct queries consistently and integrates embedding queries with the search query pipeline.
32
+
You must provide the required embedding value by using the `withEmbedding` method
33
+
34
+
### Embedding
35
+
36
+
-[`Ibexa\Contracts\Core\Repository\Values\Content\Query\Embedding`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-Embedding.html) represents the vector input used
37
+
for similarity search.
38
+
It stores embedding values as float arrays, while providers generate those vectors from text input
39
+
40
+
## Query execution
41
+
42
+
Embedding queries are executed by the search engine by using the configured embedding model and provider.
43
+
44
+
At runtime, the system resolves the appropriate embedding provider and ensures that the embedding vector is compatible with the configured model.
45
+
Runtime validation includes validating vector dimensionality and selecting the correct indexed field for similarity search.
46
+
Field selection is determined by the configured embedding model and backend specific query mapping, while vector dimensionality is validated when the query reaches the search engine.
47
+
48
+
## Embedding providers
49
+
50
+
Embedding providers implement the contract for generating vector representations of input data.
51
+
Out of the box, embedding search integration is provided for `TaxonomyEmbedding`.
52
+
If you use a custom embedding value type, implement matching embedding visitors for your [search engine](search_engines.md).
53
+
Otherwise, query execution may fail due to no visitor available.
54
+
55
+
-[`Ibexa\Contracts\Core\Search\Embedding\EmbeddingProviderInterface`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Search-Embedding-EmbeddingProviderInterface.html) generates embeddings for the provided text or other input
56
+
57
+
-[`Ibexa\Contracts\Core\Search\Embedding\EmbeddingProviderRegistryInterface`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Search-Embedding-EmbeddingProviderRegistryInterface.html) lists available embedding providers or gets one by its identifier
58
+
59
+
-[`Ibexa\Contracts\Core\Search\Embedding\EmbeddingProviderResolverInterface`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Search-Embedding-EmbeddingProviderResolverInterface.html) determines the embedding provider to be used for generating embeddings based on the system configuration, or a demand passed through the `resolveByModelIdentifier` method
60
+
61
+
## Configuration
62
+
63
+
Models used to resolve embedding queries must be configured per SiteAccess in [system configuration](configuration.md).
64
+
Each entry defines the model's name, vector dimensionality, the field suffix, and the embedding provider that generates vectors.
65
+
Field suffixes assigned to the models must be unique, as they become part of the indexed field name.
66
+
You select the default model by setting a value in the `default_embedding_model` key.
67
+
68
+
```yaml
69
+
ibexa:
70
+
system:
71
+
default:
72
+
embedding_models:
73
+
text-embedding-3-small:
74
+
name: 'text-embedding-3-small'
75
+
dimensions: 1536
76
+
field_suffix: '3small'
77
+
embedding_provider: 'ibexa_openai'
78
+
default_embedding_model: text-embedding-ada-002
79
+
```
80
+
81
+
For a real-life example of embedding models configuration, see [Taxonomy suggestions](taxonomy.md#change-the-embedding-generation-model).
82
+
83
+
- [EmbeddingConfigurationInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Search-Embedding-EmbeddingConfigurationInterface.html) allows access to the embedding model configuration in the system (for example, list of available models, default model name, default provider, field suffix, and so on)
84
+
85
+
## Embedding fields
86
+
87
+
Embedding vectors are stored in dedicated search fields.
88
+
These fields can be used by the search engine to perform vector similarity comparisons when embedding queries are executed.
Once you create a field, subscribe to the `ContentIndexCreateEvent` indexing event that [adds the field to the index](index_custom_elasticsearch_data.md).
95
+
96
+
97
+
-[`Ibexa\Contracts\Core\Search\FieldType\EmbeddingFieldFactory`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Search-FieldType-EmbeddingFieldFactory.html) creates dedicated search fields that store embedding vectors
98
+
99
+
## Validation
100
+
101
+
-[`Ibexa\Contracts\Core\Repository\Values\Content\QueryValidatorInterface`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-QueryValidatorInterface.html) validates embedding query structure before execution
Copy file name to clipboardExpand all lines: docs/search/search_api.md
+67-28Lines changed: 67 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,5 @@
1
1
---
2
+
month_change: true
2
3
description: You can search for content, locations and products by using the PHP API. Fine-tune the search with Search Criteria, Sort Clauses and Aggregations.
3
4
month_change: true
4
5
---
@@ -19,7 +20,7 @@ The service should be [injected into the constructor of your command or controll
19
20
20
21
`SearchService` is also used in the back office of [[= product_name =]], in components such as Universal Discovery Widget or Sub-items List.
21
22
22
-
### Performing a search
23
+
### Perform search
23
24
24
25
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
26
@@ -71,7 +72,7 @@ As such, `query` is recommended when the search is based on user input.
71
72
The difference between `query` and `filter` is only relevant when using Solr or Elasticsearch search engine.
72
73
With the Legacy search engine both properties give identical results.
73
74
74
-
#### Processing large result sets
75
+
#### Process large result sets
75
76
76
77
To process a large result set, use [`Ibexa\Contracts\Core\Repository\Iterator\BatchIterator`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIterator.html).
77
78
`BatchIterator` divides the results of search or filtering into smaller batches.
@@ -176,7 +177,7 @@ $filter
176
177
It's recommended to use an IDE that can recognize type hints when working with Repository Filtering.
177
178
If you try to use an unsupported Criterion or Sort Clause, the IDE indicates an issue.
178
179
179
-
## Searching in a controller
180
+
## Search in controller
180
181
181
182
You can use the `SearchService` or repository filtering in a controller, as long as you provide the required parameters.
182
183
For example, in the code below, `locationId` is provided to list all children of a location by using the `SearchService`.
@@ -197,7 +198,7 @@ When using Repository filtering, provide the results of `ContentService::find()`
To paginate search or filtering results, it's recommended to use the [Pagerfanta library](https://github.com/BabDev/Pagerfanta) and [[[= product_name =]]'s adapters for it.](https://github.com/ibexa/core/blob/main/src/lib/Pagination/Pagerfanta/Pagerfanta.php)
203
204
@@ -260,7 +261,7 @@ that doesn't belong to the provided Section:
This can lead to unexpected behavior, for instance because content can have multiple locations.
@@ -283,7 +284,7 @@ Even though the location B is hidden, the query finds the content because both c
283
284
- the content item is visible (it has the visible location A)
284
285
285
286
286
-
## Sorting results
287
+
## Sort results
287
288
288
289
To sort the results of a query, use one of more [Sort Clauses](sort_clause_reference.md).
289
290
@@ -297,27 +298,6 @@ For example, to order search results by their publication date, from oldest to n
297
298
298
299
For the full list and details of available Sort Clauses, see [Sort Clause reference](sort_clause_reference.md).
299
300
300
-
## Searching in trash
301
-
302
-
In the user interface, on the **Trash** screen, you can search for content items, and then sort the results based on different criteria.
303
-
To search the trash with the API, use the `TrashService::findInTrash` method to submit a query for content items that are held in trash.
304
-
Searching in trash supports a limited set of Criteria and Sort Clauses.
305
-
For a list of supported Criteria and Sort Clauses, see [Search in trash reference](search_in_trash_reference.md).
306
-
307
-
!!! note
308
-
309
-
Searching through the trashed content items operates directly on the database, therefore you cannot use external search engines, such as Solr or Elasticsearch, and it's impossible to reindex the data.
Make sure that you set the Criterion on the `filter` property.
319
-
It's impossible to use the `query` property, because the search in trash operation filters the database instead of querying.
320
-
321
301
## Aggregation
322
302
323
303
!!! caution "Feature support"
@@ -380,4 +360,63 @@ $query->aggregations[] = new IntegerRangeAggregation('range', 'person', 'age',
380
360
`null` means that a range doesn't have an end.
381
361
In the example all values above (and including) 60 are included in the last range.
382
362
383
-
See [Agrregation reference](aggregation_reference.md) for details of all available aggregations.
363
+
See [Aggregation reference](aggregation_reference.md) for details of all available aggregations.
364
+
365
+
## Search with embeddings
366
+
367
+
368
+
!!! note "Feature support"
369
+
370
+
Searching with embeddings requires a search engine that supports it, such as Elasticsearch or Solr 9.8.1+.
371
+
372
+
Embeddings are numerical representations that capture the meaning of text, images, or other content.
373
+
AI providers generate embeddings by converting words or documents into lists of numbers, instead of treating them as plain text.
374
+
Such lists, aka vectors, can then be compared to find content with similar meaning.
375
+
376
+
Searching with embeddings enables matching content based on meaning rather than exact text matches.
377
+
Instead of comparing keywords, the system compares vectors that represent the semantic meaning of content and the query input.
378
+
379
+
!!! note "Taxonomy suggestions"
380
+
381
+
Embedding queries have been introduced primarily to support the [Taxonomy suggestions](taxonomy.md#taxonomy-suggestions) feature, therefore embedding search integration is provided for `TaxonomyEmbedding`.
382
+
383
+
You can narrow down the search results, for example, by content type or location.
384
+
To do this, combine searching with embeddings with filters.
385
+
Repository search also respects the permissions of the current user.
386
+
387
+
An embedding query is represented by the [`Ibexa\Contracts\Core\Repository\Values\Content\EmbeddingQuery`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-EmbeddingQuery.html) value object.
388
+
The object encapsulates the embedding used for similarity search and optional search parameters such as filtering, pagination, aggregations, and result counting.
389
+
390
+
### Use embedding queries in search
391
+
392
+
Embedding queries are executed through the search API in the same way as other search requests.
393
+
You build an `EmbeddingQuery` instance by using a builder and pass it to the search service.
394
+
395
+
This example shows a minimal embedding query executed directly through the search service:
For more information, see [Embeddings reference](embeddings_reference.md).
402
+
403
+
## Search in trash
404
+
405
+
In the user interface, on the **Trash** screen, you can search for content items, and then sort the results based on different criteria.
406
+
To search the trash with the API, use the `TrashService::findInTrash` method to submit a query for content items that are held in trash.
407
+
Searching in trash supports a limited set of Criteria and Sort Clauses.
408
+
For a list of supported Criteria and Sort Clauses, see [Search in trash reference](search_in_trash_reference.md).
409
+
410
+
!!! note
411
+
412
+
Searching through the trashed content items operates directly on the database, therefore you cannot use external search engines, such as Solr or Elasticsearch, and it's impossible to reindex the data.
Copy file name to clipboardExpand all lines: docs/search/search_criteria_and_sort_clauses.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -79,7 +79,7 @@ Available tags for Sort Clause handlers in Legacy Storage Engine are:
79
79
- for Criterion handlers: `ibexa.core.trash.search.legacy.gateway.criterion_handler`
80
80
- for Sort Clause handlers: `ibexa.core.trash.search.legacy.gateway.sort_clause_handler`
81
81
82
-
For more information about searching for content items in Trash, see [Searching in trash](search_api.md#searching-in-trash).
82
+
For more information about searching for content items in Trash, see [Search in trash](search_api.md#search-in-trash).
83
83
84
84
For more information about the Criteria and Sort Clauses that are supported when searching for trashed content items, see [Searching in trash reference](search_in_trash_reference.md).
Copy file name to clipboardExpand all lines: docs/search/search_in_trash_reference.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ month_change: false
6
6
7
7
# Search in trash reference
8
8
9
-
When you [search for content items that are held in trash](search_api.md#searching-in-trash), you can apply only a limited subset of Search Criteria and Sort Clauses
9
+
When you [search for content items that are held in trash](search_api.md#search-in-trash), you can apply only a limited subset of Search Criteria and Sort Clauses
10
10
which can be used by [`Ibexa\Contracts\Core\Repository\TrashService::findTrashItems`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-TrashService.html#method_findTrashItems).
0 commit comments