SearchIndexRepository Class Reference
Repository for search index. More...
Static Public Member Functions |
|
static | add_model ($model, $id=false, $weight=1) |
Add a model. |
|
static | add_model_rule (SearchIndexModelRule $rule) |
Add a model rule. |
|
static | get_index_implementation () |
Get the index implementation. |
|
static | get_model_for_id ($id) |
static | get_model_id ($model) |
Return model id. |
|
static | get_model_rule ($model) |
Retrieve rule for given model. |
|
static | get_model_rule_for_id ($id) |
static | get_model_rules () |
static | set_index_implementation (ISearchIndex $index) |
Set the index implementation. |
Detailed Description
Repository for search index.
Used to register models and implementation
Definition at line 8 of file searchindexrepository.cls.php.
Member Function Documentation
static SearchIndexRepository::add_model | ( | $ | model, | |
$ | id = false , |
|||
$ | weight = 1 |
|||
) | [static] |
Add a model.
Definition at line 43 of file searchindexrepository.cls.php.
00043 { 00044 if (empty($id)) { 00045 $id = count(self::$model_rules) + 1; 00046 } 00047 self::add_model_rule(new SearchIndexModelRule($model, $id, $weight)); 00048 }
static SearchIndexRepository::add_model_rule | ( | SearchIndexModelRule $ | rule | ) | [static] |
Add a model rule.
Definition at line 36 of file searchindexrepository.cls.php.
static SearchIndexRepository::get_index_implementation | ( | ) | [static] |
Get the index implementation.
- Returns:
- ISearchIndex
Definition at line 24 of file searchindexrepository.cls.php.
00024 { 00025 if (self::$index) { 00026 return clone(self::$index); 00027 } else { 00028 $model = Config::get_value(ConfigSearchIndex::TABLE_NAME); 00029 return DB::create($model); 00030 } 00031 }
static SearchIndexRepository::get_model_for_id | ( | $ | id | ) | [static] |
Definition at line 75 of file searchindexrepository.cls.php.
static SearchIndexRepository::get_model_id | ( | $ | model | ) | [static] |
Return model id.
Definition at line 66 of file searchindexrepository.cls.php.
00066 { 00067 $ret = false; 00068 $rule = self::get_model_rule($model); 00069 if ($rule) { 00070 $ret = $rule->model_id; 00071 } 00072 return $ret; 00073 }
static SearchIndexRepository::get_model_rule | ( | $ | model | ) | [static] |
Retrieve rule for given model.
- Returns:
- SearchIndexModelRule
Definition at line 59 of file searchindexrepository.cls.php.
00059 { 00060 return Arr::get_item(self::$model_rules, $model, false); 00061 }
static SearchIndexRepository::get_model_rule_for_id | ( | $ | id | ) | [static] |
Definition at line 86 of file searchindexrepository.cls.php.
00086 { 00087 $model = self::get_model_for_id($id); 00088 if ($model) { 00089 return self::get_model_rule($model); 00090 } 00091 return false; 00092 }
static SearchIndexRepository::get_model_rules | ( | ) | [static] |
Definition at line 50 of file searchindexrepository.cls.php.
static SearchIndexRepository::set_index_implementation | ( | ISearchIndex $ | index | ) | [static] |
Set the index implementation.
Definition at line 15 of file searchindexrepository.cls.php.
The documentation for this class was generated from the following file:
- contributions/models.searchindex/lib/helpers/searchindexrepository.cls.php