[TikiWiki-commits] [Git][tikiwiki/tiki][27.x] [FIX] manticore: order field name casing, case-insensitive search by default...

"Victor Emanouilov \(@kroky\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6968e08cbe511_2c1819244737a@gitlab-sidekiq-low-urgency-cpu-bound-v2-7566b5b998-n4nq7.mail>

Victor Emanouilov pushed to branch 27.x at Tiki Wiki CMS Groupware / Tiki


Commits:
5ce15e81 by Victor Emanouilov at 2026-01-15T14:41:43+02:00
[FIX] manticore: order field name casing, case-insensitive search by default and distinguish between identifier and content search

- - - - -


2 changed files:

- lib/core/Search/Manticore/OrderBuilder.php
- lib/core/Search/Manticore/QueryBuilder.php


Changes:

=====================================
lib/core/Search/Manticore/OrderBuilder.php
=====================================
@@ -29,13 +29,15 @@ class OrderBuilder
 
     protected function buildOne(Order $order)
     {
-        $field = strtolower($order->getField());
-
+        $field = $order->getField();
+        $isJsonField = ($this->index && $this->index->isFieldInJson($field));
+        if (! $isJsonField) {
+            $field = strtolower($field);
+        }
         if ($order->getMode() == Order::MODE_SCRIPT) {
             $arguments = $order->getArguments();
             return $arguments['source'] . ' ' . $order->getOrder();
         } elseif ($field !== Order::FIELD_SCORE) {
-            $isJsonField = ($this->index && $this->index->isFieldInJson($field));
             if ($isJsonField) {
                 // TODO: nsort or distance?
                 $jsonPath = $this->index->getJsonPathForField($field);


=====================================
lib/core/Search/Manticore/QueryBuilder.php
=====================================
@@ -226,7 +226,7 @@ class QueryBuilder
         } elseif ($node instanceof Initial) {
             $field = $this->getField($node);
             Index::addSearchedField($node->getField(), 'others');
-            $value = $this->getQuoted($node, '^');
+            $value = $this->getQuoted($node, '(?i)^');
             return "REGEX($field, $value)";
         } elseif ($node instanceof Range) {
             $field = $this->getField($node);
@@ -273,8 +273,13 @@ class QueryBuilder
                 }
                 return "$key = 1";
             }
-            $value = $this->getQuoted($node);
-            return "{$field} = $value";
+            if ($node->getType() == 'identifier' || str_ends_with($field, '_ts')) {
+                $value = $this->getQuoted($node);
+                return "{$field} = $value";
+            } else {
+                $value = $this->getQuoted($node, '(?i)');
+                return "REGEX({$field}, $value)";
+            }
         }
         Index::addSearchedField($node->getField(), 'others');
         $mapping = $this->index ? $this->index->getFieldMapping($node->getField()) : new stdClass();
@@ -285,11 +290,11 @@ class QueryBuilder
             $value = $this->getQuoted($node);
             return "{$field} = $value";
         } else {
-            $value = $this->getQuoted($node);
+            $value = $this->getQuoted($node, '(?i)');
             if (is_array($value)) {
                 return '(' . implode(' OR ', array_filter(array_map(function ($v) use ($field) {
                     if (is_scalar($v)) {
-                        $v = $this->pdo_client->quote(strval($v));
+                        $v = $this->pdo_client->quote('(?i)' . strval($v));
                     } else {
                         return null;
                     }



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/5ce15e8165a93c8c55f147c08259b095cca49fed

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/5ce15e8165a93c8c55f147c08259b095cca49fed
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.