diff --git a/code_samples/search/content/customfield_criterion.php b/code_samples/search/content/customfield_criterion.php new file mode 100644 index 0000000000..a9a52400de --- /dev/null +++ b/code_samples/search/content/customfield_criterion.php @@ -0,0 +1,12 @@ +query = new Query\Criterion\CustomField('content_name_s', Operator::EQ, '/Ibexa.*/'); + +/** @var \Ibexa\Contracts\Core\Repository\SearchService $searchService */ +$searchService->findContent($query); diff --git a/docs/search/criteria_reference/customfield_criterion.md b/docs/search/criteria_reference/customfield_criterion.md new file mode 100644 index 0000000000..b804abbd3b --- /dev/null +++ b/docs/search/criteria_reference/customfield_criterion.md @@ -0,0 +1,27 @@ +--- +description: Custom Field Search Criterion +--- + +# Custom Field Criterion + +The [`CustomField` Search Criterion](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-Criterion-CustomField.html) searches for content or locations based on the contents of the search index fields. + +The allowed syntax and operator support might differ between search engines and the type of queried field. + +## Arguments + +- `target` - string representing the identifier of the search index field +- `operator` - one of [Operator](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-Criterion-Operator.html) constants +- `value` - the value to query for + +## Limitations + +The `CustomField` Criterion isn't available in [Repository filtering](search_api.md#repository-filtering). + +## Example + +### PHP + +``` php +[[= include_file('code_samples/search/content/customfield_criterion.php') =]] +``` diff --git a/docs/search/criteria_reference/search_criteria_reference.md b/docs/search/criteria_reference/search_criteria_reference.md index 9809caf794..7b6cde20cd 100644 --- a/docs/search/criteria_reference/search_criteria_reference.md +++ b/docs/search/criteria_reference/search_criteria_reference.md @@ -30,6 +30,7 @@ Due to this storage limitation, searching content using the Country field type o | [ContentTypeId](contenttypeid_criterion.md) | ID of the content item's content type | ✔ | ✔ | ✔ | ✔ | | [ContentTypeIdentifier](contenttypeidentifier_criterion.md) | Identifier of the content item's content type | ✔ | ✔ | ✔ | | | [CurrencyCodeCriterion](currencycode_criterion.md) | Currency code | ✔ | ✔ | ✔ | | +| [CustomField](customfield_criterion.md) | Custom field | ✔ | ✔ | | | | [DateMetadata](datemetadata_criterion.md) | The date when content was created or last modified | ✔ | ✔ | ✔ | ✔ | | [Depth](depth_criterion.md) | Location depth in the content tree | | ✔ | ✔ | | | [Field](field_criterion.md) | Content of one of content item's fields | ✔ | ✔ | | | diff --git a/mkdocs.yml b/mkdocs.yml index ca209a9202..4183439072 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -516,6 +516,7 @@ nav: - ContentTypeId: search/criteria_reference/contenttypeid_criterion.md - ContentTypeIdentifier: search/criteria_reference/contenttypeidentifier_criterion.md - CurrencyCode: search/criteria_reference/currencycode_criterion.md + - CustomField: search/criteria_reference/customfield_criterion.md - CustomerGroupId: search/criteria_reference/customergroupid_criterion.md - DateMetadata: search/criteria_reference/datemetadata_criterion.md - Depth: search/criteria_reference/depth_criterion.md