/
StandardSearchIndexerInterface.php
59 lines (55 loc) · 1.89 KB
/
StandardSearchIndexerInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
namespace Concrete\Core\Attribute\Category\SearchIndexer;
/**
* Class to be implemented by attribute categories to define the attribute indexing table.
*/
interface StandardSearchIndexerInterface
{
/**
* Get the name of the indexing table (return false if there's no indexing table).
*
* @return string|false
*/
public function getIndexedSearchTable();
/**
* Get the definition of the indexing table, excluding attribute-related fields (return false if there's no indexing table).
* The resulting array can have these keys:
* - columns: an array describing the table columns
* - primary: an array containing the names of the columns that define the table primary key
* - foreignKeys: an array describing the foreign keys.
*
* @return array|false
*
* @example Here's what the File attribute category returns:
* [
* 'columns' => [
* [
* 'name' => 'fID',
* 'type' => 'integer',
* 'options' => ['unsigned' => true, 'default' => 0, 'notnull' => true],
* ],
* ],
* 'primary' => ['fID'],
* 'foreignKeys' => [
* [
* 'foreignTable' => 'Files',
* 'localColumns' => ['fID'],
* 'foreignColumns' => ['fID'],
* 'onUpdate' => 'CASCADE',
* 'onDelete' => 'CASCADE',
* ],
* ],
* ]
*/
public function getSearchIndexFieldDefinition();
/**
* Get the value of the primary key column of the indexing table that identifies the object to be indexed.
*
* @param object $mixed The object for which we need the identifier
*
* @return mixed
*
* @example For the File attribute category, the file ID will be returned.
*/
public function getIndexedSearchPrimaryKeyValue($mixed);
}