[COMPONENT][Search][Attachment][DOC] Add doocumentation to search related functions
This commit is contained in:
parent
24291a268a
commit
1b45fb251a
@ -71,6 +71,9 @@ class Attachment extends Component
|
|||||||
return Event::next;
|
return Event::next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Populate $note_expr with the criteria for looking for notes with attachments
|
||||||
|
*/
|
||||||
public function onSearchCreateExpression(ExpressionBuilder $eb, string $term, ?string $language, &$note_expr, &$actor_expr): bool
|
public function onSearchCreateExpression(ExpressionBuilder $eb, string $term, ?string $language, &$note_expr, &$actor_expr): bool
|
||||||
{
|
{
|
||||||
$include_term = str_contains($term, ':') ? explode(':', $term)[1] : $term;
|
$include_term = str_contains($term, ':') ? explode(':', $term)[1] : $term;
|
||||||
|
@ -45,6 +45,11 @@ class Search extends Component
|
|||||||
$r->connect('search', '/search', Controller\Search::class);
|
$r->connect('search', '/search', Controller\Search::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function for generating and processing the search form, so it can be embedded in
|
||||||
|
* multiple places. Can be provided with a $query, which will prefill the query field. If
|
||||||
|
* $add_subscribe, allow the user to add the current query to their left panel
|
||||||
|
*/
|
||||||
public static function searchForm(Request $request, ?string $query = null, bool $add_subscribe = false): FormView
|
public static function searchForm(Request $request, ?string $query = null, bool $add_subscribe = false): FormView
|
||||||
{
|
{
|
||||||
$actor = Common::actor();
|
$actor = Common::actor();
|
||||||
@ -136,6 +141,10 @@ class Search extends Component
|
|||||||
return Event::next;
|
return Event::next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert $term to $note_expr and $actor_expr, search criteria. Handles searching for text
|
||||||
|
* notes, for different types of actors and for the content of text notes
|
||||||
|
*/
|
||||||
public function onSearchCreateExpression(ExpressionBuilder $eb, string $term, ?string $language, &$note_expr, &$actor_expr): bool
|
public function onSearchCreateExpression(ExpressionBuilder $eb, string $term, ?string $language, &$note_expr, &$actor_expr): bool
|
||||||
{
|
{
|
||||||
$include_term = str_contains($term, ':') ? explode(':', $term)[1] : $term;
|
$include_term = str_contains($term, ':') ? explode(':', $term)[1] : $term;
|
||||||
|
Loading…
Reference in New Issue
Block a user