-
-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Delete search index entries under more specific conditions (see #7266)
Description ----------- In a Contao instance of a customer where indexing of protected pages is enabled I noticed the following issue: if the URL of protected and already indexed page is requested without a valid login for that page, the URL gets deleted from the search index. To fix this I first thought of ignoring the `401` and `403` status code in our `SearchIndexListener` for the delete operation. However, then I realized that there are other status codes where the same holds true: a `503` status code is only temporary and any URL responding momentarily with that status code should not be removed from the index (neither would Google, they would only remove the URL from the index if that status code persists over a longer period of time). Then I realized the same holds true for the `500` status code. Any error happening under a specific URL might only be temporary and thus the URL should not be removed from the index (neither would Google, they would only remove the URL from the index if that status code persists over a longer period of time). Thus I then decided to completely revamp the conditions under which a URL should be deleted from the index: * If the status code is `404` or `410`, always delete from the index. * If the response is succesful and the `X-Robots-Tag` contains `noindex`, always delete from the index. * If the response is succesful and the HTML contains the meta robots tag with `noindex`, always delete from the index. * Otherwise never delete from the index automatically, as any other state might just be temporary for any given URL. Commits ------- 3392dfe revamp SearchIndexListener 018340e update wording 3126738 add comment 9ca90d6 Apply suggestions from code review 74ea635 adjust test and add comment 41d2dc7 remove unused argument 377fe5b Apply suggestions from code review e8287f5 remove remaining trailing space
- Loading branch information
Showing
2 changed files
with
83 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters