[TikiWiki-commits] [Git][tikiwiki/tiki][29.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 <6968e09beab10_2c18192430389@gitlab-sidekiq-low-urgency-cpu-bound-v2-7566b5b998-b2gpz.mail>

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


Commits:
ba17cc74 by Victor Emanouilov at 2026-01-15T14:41:58+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/ba17cc74f9f8f56a9cdd96f2e4fb63517433579f

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/ba17cc74f9f8f56a9cdd96f2e4fb63517433579f
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.