mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
11595952f4
* NEW Search across multiple searchable fields by default * ENH Split search query and search each term separately.
51 lines
1.3 KiB
PHP
51 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace SilverStripe\ORM\Tests\Search\SearchContextTest;
|
|
|
|
use SilverStripe\Dev\TestOnly;
|
|
use SilverStripe\Forms\TextField;
|
|
use SilverStripe\ORM\DataObject;
|
|
|
|
class GeneralSearch extends DataObject implements TestOnly
|
|
{
|
|
private static $table_name = 'SearchContextTest_GeneralSearch';
|
|
|
|
private static $db = [
|
|
'Name' => 'Varchar',
|
|
'DoNotUseThisField' => 'Varchar',
|
|
'HairColor' => 'Varchar',
|
|
'ExcludeThisField' => 'Varchar',
|
|
'ExactMatchField' => 'Varchar',
|
|
'PartialMatchField' => 'Varchar',
|
|
'MatchAny1' => 'Varchar',
|
|
'MatchAny2' => 'Varchar',
|
|
];
|
|
|
|
private static $has_one = [
|
|
'Customer' => Customer::class,
|
|
'ShippingAddress' => Address::class,
|
|
];
|
|
|
|
private static $searchable_fields = [
|
|
'Name',
|
|
'HairColor',
|
|
'ExcludeThisField' => [
|
|
'general' => false,
|
|
],
|
|
'ExactMatchField' => [
|
|
'filter' => 'ExactMatchFilter',
|
|
],
|
|
'PartialMatchField' => [
|
|
'filter' => 'PartialMatchFilter',
|
|
],
|
|
'MatchAny' => [
|
|
'field' => TextField::class,
|
|
'match_any' => [
|
|
'MatchAny1',
|
|
'MatchAny2',
|
|
'Customer.MatchAny',
|
|
]
|
|
]
|
|
];
|
|
}
|