Skip to content

Commit

Permalink
fix: allow performing only class search
Browse files Browse the repository at this point in the history
  • Loading branch information
bartlomiejmarszal committed May 21, 2024
1 parent b4ac21d commit 00b027b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 3 additions & 1 deletion core/kernel/persistence/smoothsql/class.Class.php
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@ public function getFilteredQuery(core_kernel_classes_Class $resource, $propertyF
$limit = (isset($options['limit']) === false) ? 0 : $options['limit'];
$order = (isset($options['order']) === false) ? '' : $options['order'];
$orderdir = (isset($options['orderdir']) === false) ? 'ASC' : $options['orderdir'];
$onlyClass = (isset($options['onlyClass']) === false) ? false : $options['onlyClass'];

if ($this->getServiceLocator()->has(ComplexSearchService::SERVICE_ID)) {
$search = $this->getModel()->getSearchInterface();
Expand All @@ -576,7 +577,8 @@ public function getFilteredQuery(core_kernel_classes_Class $resource, $propertyF
$offset,
$limit,
$order,
$orderdir
$orderdir,
$onlyClass
);
} else {
$query = core_kernel_persistence_smoothsql_Utils::buildFilterQuery(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ public function getQuery(
$offset = 0,
$limit = 0,
$order = '',
$orderDir = 'ASC'
$orderDir = 'ASC',
$onlyClass = false
) {
$query = $this->getGateway()->query()->setLimit($limit)->setOffset($offset);

Expand All @@ -248,9 +249,15 @@ public function getQuery(

$this->setLanguage($query, $lang);

$criteria = $query->newQuery()
if ($onlyClass === true) {
$criteria = $query->newQuery()
->add('http://www.w3.org/2000/01/rdf-schema#subClassOf')
->in($classUri);
} else {
$criteria = $query->newQuery()
->add('http://www.w3.org/1999/02/22-rdf-syntax-ns#type')
->in($classUri);
}

$query->setCriteria($criteria);
$count = 0;
Expand Down

0 comments on commit 00b027b

Please sign in to comment.