Skip to content

Commit

Permalink
Fixed cloud project searching
Browse files Browse the repository at this point in the history
  • Loading branch information
thommcgrath committed Feb 15, 2024
1 parent 2a1e4e3 commit e9f2e4f
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions Website/api/v4/classes/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,17 +178,22 @@ protected static function BuildSearchParameters(DatabaseSearchParameters $parame
}

if (isset($filters['search']) && empty($filters['search']) === false) {
$search = new BeaconSearch();
$results = $search->Search($filters['search'], null, 100, 'Document');
if (count($results) > 0) {
$ids = [];
foreach ($results as $result) {
$ids[] = $result['objectID'];
if (array_key_exists('communityStatus', $filters)) {
$search = new BeaconSearch();
$results = $search->Search($filters['search'], null, 100, 'Document');
if (count($results) > 0) {
$ids = [];
foreach ($results as $result) {
$ids[] = $result['objectID'];
}
$parameters->clauses[] = $schema->Comparison('projectId', '=', 'ANY($' . $parameters->placeholder++ . ')');
$parameters->values[] = '{' . implode(',', $ids) . '}';
} else {
$parameters->clauses[] = $schema->Comparison('projectId', '=', "'00000000-0000-0000-0000-000000000000'");
}
$parameters->clauses[] = $schema->Comparison('projectId', '=', 'ANY($' . $parameters->placeholder++ . ')');
$parameters->values[] = '{' . implode(',', $ids) . '}';
} else {
$parameters->clauses[] = $schema->Comparison('projectId', '=', "'00000000-0000-0000-0000-000000000000'");
$parameters->clauses[] = $schema->Comparison('name', 'LIKE', '$' . $parameters->placeholder++);
$parameters->values[] = '%' . str_replace(['%', '_'], ['\\%', '\\_'], $filters['search']) . '%';
}
}

Expand Down

0 comments on commit e9f2e4f

Please sign in to comment.