forked from GNUsocial/gnu-social
[COMPONENT][Search] Fix searching for actors
This commit is contained in:
parent
139da2c07f
commit
bc3e6ac704
@ -47,11 +47,14 @@ class Search extends FeedController
|
||||
$note_qb->select('note')->from('App\Entity\Note', 'note')->orderBy('note.created', 'DESC');
|
||||
$actor_qb->select('actor')->from('App\Entity\Actor', 'actor')->orderBy('actor.created', 'DESC');
|
||||
Event::handle('SearchQueryAddJoins', [&$note_qb, &$actor_qb]);
|
||||
|
||||
$notes = $actors = [];
|
||||
if (!\is_null($note_criteria)) {
|
||||
$note_qb->addCriteria($note_criteria);
|
||||
$notes = $note_qb->getQuery()->execute();
|
||||
} elseif (!\is_null($actor_criteria)) {
|
||||
}
|
||||
|
||||
if (!\is_null($actor_criteria)) {
|
||||
$actor_qb->addCriteria($actor_criteria);
|
||||
$actors = $actor_qb->getQuery()->execute();
|
||||
}
|
||||
|
@ -99,8 +99,8 @@ class Search extends Component
|
||||
{
|
||||
if (Formatting::startsWith($term, ['lang', 'language'])) {
|
||||
$search_term = str_contains($term, ':') ? explode(':', $term)[1] : $term;
|
||||
$note_expr = $eb->eq('language.locale', $search_term);
|
||||
$actor_expr = $eb->eq('language.locale', $search_term);
|
||||
$note_expr = $eb->startsWith('language.locale', $search_term);
|
||||
$actor_expr = $eb->startsWith('language.locale', $search_term);
|
||||
return Event::stop;
|
||||
}
|
||||
return Event::next;
|
||||
|
@ -80,12 +80,12 @@ abstract class Parser
|
||||
$ret = Event::handle('SearchCreateExpression', [$eb, $term, $language, &$note_res, &$actor_res]);
|
||||
if (\is_null($note_res) && \is_null($actor_res)) {
|
||||
throw new ServerException("No one claimed responsibility for a match term: {$term}");
|
||||
} elseif (!\is_null($note_res)) {
|
||||
}
|
||||
if (!\is_null($note_res)) {
|
||||
$note_parts[] = $note_res;
|
||||
} elseif (!\is_null($actor_res)) {
|
||||
}
|
||||
if (!\is_null($actor_res)) {
|
||||
$actor_parts[] = $actor_res;
|
||||
} else {
|
||||
throw new ServerException('Unexpected state in Search parser');
|
||||
}
|
||||
|
||||
$right = $left = $index + 1;
|
||||
@ -109,7 +109,8 @@ abstract class Parser
|
||||
if (!empty($note_parts)) {
|
||||
self::connectParts($note_parts, $note_criteria_arr, $last_op, $eb, force: true);
|
||||
$note_criteria = new Criteria($eb->orX(...$note_criteria_arr));
|
||||
} elseif (!empty($actor_parts)) {
|
||||
}
|
||||
if (!empty($actor_parts)) {
|
||||
self::connectParts($actor_parts, $actor_criteria_arr, $last_op, $eb, force: true);
|
||||
$actor_criteria = new Criteria($eb->orX(...$actor_criteria_arr));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user