Skip to content

Custom Field Criterion

The CustomField Search Criterion 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 constants
  • value - the value to query for

Limitations

The CustomField Criterion isn't available in Repository filtering.

Example

PHP

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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);