[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] manticore: facet naming and query fix
"Victor Emanouilov \(@kroky\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <6968bba37d82a_2c181938403@gitlab-sidekiq-low-urgency-cpu-bound-v2-9fd947f7b-tdjs8.mail> |
Victor Emanouilov pushed to branch master at Tiki Wiki CMS Groupware / Tiki
Commits:
80d5ff27 by Victor Emanouilov at 2026-01-15T12:04:13+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/80d5ff27a4a12db58d0801300ddd868a23701e1f
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/80d5ff27a4a12db58d0801300ddd868a23701e1f
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