[TikiWiki-commits] [Git][tikiwiki/tiki][26.x] [FIX] manticore/mysql index optimization: include object_id/type and partially...
"Victor Emanouilov \(@kroky\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <68dcf7117308e_2cdee041001a8@gitlab-sidekiq-low-urgency-cpu-bound-v2-79f8d84998-rtxh9.mail> |
Victor Emanouilov pushed to branch 26.x at Tiki Wiki CMS Groupware / Tiki
Commits:
c982c533 by Victor Emanouilov at 2025-10-01T12:40:26+03:00
[FIX] manticore/mysql index optimization: include object_id/type and partially revert this change in search lookup controller as it needs field types like _text and _paths
- - - - -
2 changed files:
- lib/core/Search/Query.php
- lib/core/Services/Search/Controller.php
Changes:
=====================================
lib/core/Search/Query.php
=====================================
@@ -47,6 +47,12 @@ class Search_Query implements Search_Query_Interface
public function setSelectionFields(array $fields)
{
+ if (! in_array('object_type', $fields)) {
+ $fields[] = 'object_type';
+ }
+ if (! in_array('object_id', $fields)) {
+ $fields[] = 'object_id';
+ }
$this->selectionFields = $fields;
}
=====================================
lib/core/Services/Search/Controller.php
=====================================
@@ -185,9 +185,7 @@ class Services_Search_Controller
/** @var UnifiedSearchLib $lib */
$lib = TikiLib::lib('unifiedsearch');
- $format_pattern = '/\{([\w\.]+)\}/';
-
- if (! empty($filter['title']) && preg_match_all($format_pattern, $format, $matches)) {
+ if (! empty($filter['title']) && preg_match_all('/\{(\w+)\}/', $format, $matches)) {
// formatted object_selector search results should also search in formatted fields besides the title
$titleFilter = $filter['title'];
unset($filter['title']);
@@ -215,18 +213,14 @@ class Services_Search_Controller
$query->setOrder($input->sort_order->text() ?: 'title_asc');
$query->setRange($input->offset->int(), $input->maxRecords->int() ?: $prefs['maxRecords']);
- if (preg_match_all($format_pattern, $format, $m)) {
- $query->setSelectionFields($m[1]);
- }
-
$result = $query->search($lib->getIndex());
- $result->applyTransform(function ($item) use ($format, $format_pattern, $smarty, $titleFilter, $highlightHelper) {
+ $result->applyTransform(function ($item) use ($format, $smarty, $titleFilter, $highlightHelper) {
$transformed = [
'object_type' => $item['object_type'],
'object_id' => $item['object_id'],
'parent_id' => $item['gallery_id'],
- 'title' => preg_replace_callback($format_pattern, function ($matches) use ($item, $format, $titleFilter, $highlightHelper) {
+ 'title' => preg_replace_callback('/\{([\w\.]+)\}/', function ($matches) use ($item, $format, $titleFilter, $highlightHelper) {
$key = $matches[1];
if (isset($item[$key])) {
// if this is a trackeritem we do not want only the name but also the trackerid listed when setting up a field
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/c982c533dbd95c26ac02ddac27a52b1583e6f6e0
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/c982c533dbd95c26ac02ddac27a52b1583e6f6e0
You're receiving this email because of your account on gitlab.com.
_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs