Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return early in the Search::indexPage() method if nothing has changed #2249

Merged
merged 3 commits into from
Sep 8, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions core-bundle/src/Resources/contao/library/Contao/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,15 @@ public static function indexPage($arrData)
->limit(1)
->execute($arrSet['checksum'], $arrSet['pid']);

// Update the URL if the new URL is shorter or the current URL is not canonical
if ($objIndex->numRows && $objIndex->url != $arrSet['url'])
if ($objIndex->numRows)
{
// The page has already been indexed and has not changed (see #2235)
if ($objIndex->url == $arrSet['url'])
{
return true;
leofeyer marked this conversation as resolved.
Show resolved Hide resolved
}

// Update the URL if the new URL is shorter or the current URL is not canonical
if (strpos($objIndex->url, '?') !== false && strpos($arrSet['url'], '?') === false)
{
// The new URL is more canonical (no query string)
Expand Down