Skip to content

Commit

Permalink
fixed problem that media object properties 'name', 'code' and 'tags' …
Browse files Browse the repository at this point in the history
…were not merged into fulltext index
  • Loading branch information
michael-graute committed May 17, 2021
1 parent a21d41e commit 3354ea1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/Pressmind/ORM/Object/MediaObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -951,25 +951,34 @@ public function createSearchIndex()
$complete_fulltext = [];
$fulltext = [];
foreach ($this->data as $data) {
$complete_fulltext = [];
$complete_fulltext[$data->language] = [];
$fulltext[] = [
'var_name' => 'code',
'language' => $data->language,
'id_media_object' => $this->getId(),
'fulltext_values' => $this->code
];
if (in_array('code', $config['data']['media_types_fulltext_index_fields'][$this->id_object_type])) {
$complete_fulltext[$data->language][] = $this->code;
}
$fulltext[] = [
'var_name' => 'name',
'language' => $data->language,
'id_media_object' => $this->getId(),
'fulltext_values' => $this->name
];
if (in_array('name', $config['data']['media_types_fulltext_index_fields'][$this->id_object_type])) {
$complete_fulltext[$data->language][] = $this->name;
}
$fulltext[] = [
'var_name' => 'tags',
'language' => $data->language,
'id_media_object' => $this->getId(),
'fulltext_values' => $this->tags
];
if (in_array('tags', $config['data']['media_types_fulltext_index_fields'][$this->id_object_type])) {
$complete_fulltext[$data->language][] = $this->tags;
}
foreach ($data->getPropertyDefinitions() as $name => $definition) {
$add_to_complete_fulltext = in_array($name, $config['data']['media_types_fulltext_index_fields'][$this->id_object_type]);
if ($definition['type'] == 'string') {
Expand Down
2 changes: 1 addition & 1 deletion src/Pressmind/ObjectTypeScaffolder.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public function parse()
if(!isset($conf['data']['media_types_fulltext_index_fields'])) {
$conf['data']['media_types_fulltext_index_fields'] = [];
}
$conf['data']['media_types_fulltext_index_fields'][$this->_tablename] = $this->getVarNames();
$conf['data']['media_types_fulltext_index_fields'][$this->_tablename] = array_merge(['name' => 'name', 'code' => 'code', 'tags' => 'tags'], $this->getVarNames());
Registry::getInstance()->get('config_adapter')->write($conf);
Registry::getInstance()->add('config', $conf);
foreach ($this->_log as $log) {
Expand Down

0 comments on commit 3354ea1

Please sign in to comment.