Skip to content

Commit

Permalink
#8693 Do not index words longer than maximum
Browse files Browse the repository at this point in the history
  • Loading branch information
asmecher committed Feb 24, 2023
1 parent 1ab5ccc commit d18522c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions classes/search/SubmissionSearchDAO.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@
namespace PKP\search;

use Illuminate\Support\Facades\DB;
use PKP\core\PKPString;

class SubmissionSearchDAO extends \PKP\db\DAO
{
public const MAX_KEYWORD_LENGTH = 60;

/**
* Add a word to the keyword list (if it doesn't already exist).
*
Expand All @@ -30,6 +33,10 @@ class SubmissionSearchDAO extends \PKP\db\DAO
*/
public function insertKeyword($keyword)
{
if (PKPString::strlen($keyword) > self::MAX_KEYWORD_LENGTH) {
return null;
}

static $submissionSearchKeywordIds = [];
if (isset($submissionSearchKeywordIds[$keyword])) {
return $submissionSearchKeywordIds[$keyword];
Expand Down

0 comments on commit d18522c

Please sign in to comment.