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

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

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


Commits:
3ad692aa by Victor Emanouilov at 2026-01-15T12:05:10+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/3ad692aae359e68bf0f322a167db2479ee019e3d

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