Skip to content

Commit

Permalink
Fix for search indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
yurabakhtin committed May 15, 2024
1 parent 24ce2be commit 7aafe0d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Changelog
1.10.3 (Unreleased)
------------------------
- Fix #321: Fix indexing of template content for search
- Fix #326: Fix for search indexing

1.10.2 (January 8, 2024)
------------------------
Expand Down
12 changes: 2 additions & 10 deletions models/CustomContentContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ abstract class CustomContentContainer extends ContentActiveRecord
const VISIBILITY_PRIVATE = 0;
const VISIBILITY_PUBLIC = 1;

/**
* @inheritdoc
*/
public $streamChannel = null;

/**
* @inheritdoc
*/
Expand Down Expand Up @@ -494,11 +489,8 @@ public function beforeSave($insert)
break;
}

if ($this->checkAbstract() && !$this->admin_only) {
$this->streamChannel = 'default';
} else {
$this->streamChannel = null;
}
// Keep page hidden on stream when "Abstract" field is not filled, or it is visible only for admin
$this->content->hidden = $this->admin_only || !$this->checkAbstract();

return parent::beforeSave($insert);
}
Expand Down
2 changes: 1 addition & 1 deletion models/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public function getSearchAttributes()
'title' => $this->title,
'content' => preg_replace('/[\r\n\s]+/', ' ', strip_tags($this->type === TemplateType::ID
? TemplateRenderer::render($this, false, false)
: $this->page_content)),
: $this->abstract . "\r\n" . $this->page_content)),
];
}

Expand Down

0 comments on commit 7aafe0d

Please sign in to comment.