Skip to content

Commit

Permalink
Merge branch 'release-15.34.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Dec 11, 2023
2 parents b481bea + f0c11f4 commit fc33713
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
2 changes: 1 addition & 1 deletion core/kernel/persistence/starsql/search/GateWay.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private function fetchObjectList(Statement $query): array
if (!$object) {
continue;
}
$returnValue[] = \common_Utils::toResource($object);
$returnValue[] = \common_Utils::toResource($object->getProperty('uri'));
}
return $returnValue;
}
Expand Down
25 changes: 10 additions & 15 deletions core/kernel/persistence/starsql/search/QuerySerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,30 +315,25 @@ protected function buildLanguagePattern(QueryConvertible $predicate): RawExpress

protected function buildReturn(Node $subject): void
{
$this->returnStatements[] = $subject->property('uri');
$this->returnStatements[] = Query::rawExpression(
sprintf('DISTINCT %s', $subject->getVariable()->toQuery())
);
}

protected function buildOrderCondition(Node $subject): void
{
$sortCriteria = $this->criteriaList->getSort();
$queryOptions = $this->criteriaList->getOptions();
$isDistinct = $queryOptions['distinct'] ?? false;

$sort = [];
if ($this->criteriaList->getRandom() && !$isDistinct) {
$this->returnStatements[] = Procedure::raw('rand')->alias('rnd');
$sort[] = '`rnd`';
} else {
foreach ($sortCriteria as $field => $order) {
$predicate = $subject->property($field);

$orderProperty = ModelManager::getModel()->getProperty($field);
if ($orderProperty->isLgDependent()) {
$predicate = $this->buildLanguagePattern($predicate);
}
foreach ($sortCriteria as $field => $order) {
$predicate = $subject->property($field);

$sort[] = $predicate->toQuery() . ((strtolower($order) === 'desc') ? ' DESCENDING' : '');
$orderProperty = ModelManager::getModel()->getProperty($field);
if ($orderProperty->isLgDependent()) {
$predicate = $this->buildLanguagePattern($predicate);
}

$sort[] = $predicate->toQuery() . ((strtolower($order) === 'desc') ? ' DESCENDING' : '');
}

if (!empty($sort)) {
Expand Down

0 comments on commit fc33713

Please sign in to comment.