From: Dan Brown Date: Tue, 9 Nov 2021 15:13:15 +0000 (+0000) Subject: Added missing comments or types X-Git-Tag: v21.11~1^2~17^2~14 X-Git-Url: http://source.bookstackapp.com/bookstack/commitdiff_plain/0ddd0528181fde31e9d3a45f3ec5c2efaba44995 Added missing comments or types Checked over latest changes for potential SQL injection, all variable usages are either (from trusted sourced AND case) or using parameters/bindings to ensure it's handled at driver/lib level. --- diff --git a/app/Entities/Tools/SearchRunner.php b/app/Entities/Tools/SearchRunner.php index 3bcd6c054..afe5e9f19 100644 --- a/app/Entities/Tools/SearchRunner.php +++ b/app/Entities/Tools/SearchRunner.php @@ -237,6 +237,8 @@ class SearchRunner * Create a select statement, with prepared bindings, for the given * set of scored search terms. * + * @param array $scoredTerms + * * @return array{statement: string, bindings: string[]} */ protected function selectForScoredTerms(array $scoredTerms): array @@ -258,6 +260,13 @@ class SearchRunner ]; } + /** + * For the terms in the given search options, query their popularity across all + * search terms then provide that back as score adjustment multiplier applicable + * for their rarity. Returns an array of float multipliers, keyed by term. + * + * @return array + */ protected function getTermAdjustments(SearchOptions $options): array { if (isset($this->termAdjustmentCache[$options])) {