Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions code_samples/search/content/customfield_criterion.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php declare(strict_types=1);

use Ibexa\Contracts\Core\Repository\Values\Content\Query;
use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Operator;

$query = new Query();

// Example Solr query: find content items with "content_name_s" starting with "Ibexa"
$query->query = new Query\Criterion\CustomField('content_name_s', Operator::EQ, '/Ibexa.*/');

/** @var \Ibexa\Contracts\Core\Repository\SearchService $searchService */
$searchService->findContent($query);
27 changes: 27 additions & 0 deletions docs/search/criteria_reference/customfield_criterion.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---

Check warning on line 1 in docs/search/criteria_reference/customfield_criterion.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/search/criteria_reference/customfield_criterion.md#L1

[Ibexa.ReadingLevel] The grade level is 12.61. Aim for 8th grade or lower by using shorter sentences and words.
Raw output
{"message": "[Ibexa.ReadingLevel] The grade level is 12.61. Aim for 8th grade or lower by using shorter sentences and words.", "location": {"path": "docs/search/criteria_reference/customfield_criterion.md", "range": {"start": {"line": 1, "column": 1}}}, "severity": "WARNING"}
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.

Check failure on line 7 in docs/search/criteria_reference/customfield_criterion.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/search/criteria_reference/customfield_criterion.md#L7

[Ibexa.VariablesGlobal] Use global variable '[[= product_name_base =]]' instead of 'Ibexa'
Raw output
{"message": "[Ibexa.VariablesGlobal] Use global variable '[[= product_name_base =]]' instead of 'Ibexa'", "location": {"path": "docs/search/criteria_reference/customfield_criterion.md", "range": {"start": {"line": 7, "column": 77}}}, "severity": "ERROR"}

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

Check failure on line 14 in docs/search/criteria_reference/customfield_criterion.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/search/criteria_reference/customfield_criterion.md#L14

[Ibexa.VariablesGlobal] Use global variable '[[= product_name_base =]]' instead of 'Ibexa'
Raw output
{"message": "[Ibexa.VariablesGlobal] Use global variable '[[= product_name_base =]]' instead of 'Ibexa'", "location": {"path": "docs/search/criteria_reference/customfield_criterion.md", "range": {"start": {"line": 14, "column": 73}}}, "severity": "ERROR"}
- `value` - the value to query for

## Limitations

Check warning on line 17 in docs/search/criteria_reference/customfield_criterion.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/search/criteria_reference/customfield_criterion.md#L17

[Ibexa.HeadingContent] Rename the heading '## Limitations', or re-purpose the content elsewhere.
Raw output
{"message": "[Ibexa.HeadingContent] Rename the heading '## Limitations', or re-purpose the content elsewhere.", "location": {"path": "docs/search/criteria_reference/customfield_criterion.md", "range": {"start": {"line": 17, "column": 1}}}, "severity": "WARNING"}

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') =]]
```
Original file line number Diff line number Diff line change
Expand Up @@ -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 | &#10004; | &#10004; | &#10004; | &#10004; |
| [ContentTypeIdentifier](contenttypeidentifier_criterion.md) | Identifier of the content item's content type | &#10004; | &#10004; | &#10004; | |
| [CurrencyCodeCriterion](currencycode_criterion.md) | Currency code | &#10004; | &#10004; | &#10004; | |
| [CustomField](customfield_criterion.md) | Custom field | &#10004; | &#10004; | | |
| [DateMetadata](datemetadata_criterion.md) | The date when content was created or last modified | &#10004; | &#10004; | &#10004; | &#10004; |
| [Depth](depth_criterion.md) | Location depth in the content tree | | &#10004; | &#10004; | |
| [Field](field_criterion.md) | Content of one of content item's fields | &#10004; | &#10004; | | |
Expand Down
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading