[TikiWiki-commits] [Git][tikiwiki/tiki][29.x] [FIX] manticore: facet naming and query fix

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

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


Commits:
85746f65 by Victor Emanouilov at 2026-01-15T12:05:03+02:00
[FIX] manticore: facet naming and query fix

- - - - -


1 changed file:

- lib/core/Search/Manticore/FacetBuilder.php


Changes:

=====================================
lib/core/Search/Manticore/FacetBuilder.php
=====================================
@@ -44,13 +44,14 @@ class FacetBuilder
         $field = $facet->getField();
         $isJsonField = ($this->index && $this->index->isFieldInJson($field));
         if ($isJsonField) {
-            $facetField = $this->index->getJsonPathForField($field) . '_ts';
+            $facetField = $this->index->getJsonPathForField($field);
+            $facetDateField = $facetField . '_ts';
         } else {
             $field = strtolower($field);
             if (! in_array($field, $this->possibleFields)) {
                 return $out;
             }
-            $facetField = $field;
+            $facetField = $facetDateField = $field;
             try {
                 $this->index->ensureHasField($facetField);
             } catch (Exception $e) {
@@ -61,17 +62,17 @@ class FacetBuilder
 
         $type = $facet->getType();
         if ($type === 'date_histogram') {
-            $out = 'FACET DATE_HISTOGRAM(BIGINT(' . $facetField . '), {calendar_interval=\'' . $facet->getInterval() . '\'}) AS ' . $facet->getName() . ' ORDER BY FACET() ASC';
+            $out = 'FACET DATE_HISTOGRAM(BIGINT(' . $facetDateField . '), {calendar_interval=\'' . $facet->getInterval() . '\'}) AS ' . $facet->getName() . ' ORDER BY FACET() ASC';
         } elseif ($type === 'date_range') {
             $ranges = array_map(function ($range) {
                 return '{range_from=\'' . $range['from'] . '\',range_to=\'' . $range['to'] . '\'}';
             }, $facet->getRanges());
-            $out = 'FACET DATE_RANGE(BIGINT(' . $facetField . '), ' . implode(',', $ranges) . ') AS ' . $facet->getName() . ' ORDER BY FACET() ASC';
+            $out = 'FACET DATE_RANGE(BIGINT(' . $facetDateField . '), ' . implode(',', $ranges) . ') AS ' . $facet->getName() . ' ORDER BY FACET() ASC';
         } else {
             $count = $facet->getCount() ?: $this->count;
             $order = $facet->getOrder();
 
-            $out = 'FACET ' . $facet->getName() . ' BY ' . $facetField;
+            $out = 'FACET ' . $facetField . ' AS ' . $facet->getName();
             if ($order) {
                 foreach ($order as $field => $direction) {
                     $out .= ' ORDER BY ' . $field . ' ' . $direction;



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/85746f651a42f90ae7b87798b33222082b8aca27

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