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

[BUGFIX] Retry Uri Building after exception #3562

Merged
merged 1 commit into from
Sep 20, 2023
Merged

[BUGFIX] Retry Uri Building after exception #3562

merged 1 commit into from
Sep 20, 2023

Conversation

saitho
Copy link
Contributor

@saitho saitho commented Mar 29, 2023

What this pr does

When there are route enhancers defined for a page containing the Solr search plugin, e.g. to realize pretty URLs for the search term, filters or pagination, there are issues with the URI caching that utilizes placeholders. Placeholders usually do not get replaced, leading to the issue described in #2984.

This PR implements a solution for route enhancers that define requirements in their parameters. The requirements are checked against the placeholders, leading to an exception. This exception is caught and it will then proceed the URI building with the original arguments instead of the placeholder arguments.

Fixes: #2984

How to test

Scenario 1: Speaking URL for search term

See #2984

Scenario 2: Speaking URLs for pagination

  1. Set up the following route enhancer (set the page containing the Solr list plugin in limitToPages):
routeEnhancers:
  SolrPagination:
    type: Plugin
    namespace: 'tx_solr'
    routePath: '/{page}'
    defaults:
      page: 0
    requirements:
      page: '\d+'
    limitToPages: [1]
  1. Clear TYPO3 cache
  2. Open the Solr list plugin (e.g. https://mysite.dev/search)
  3. The pagination links should be pretty (e.g. https://mysite.dev/search/1, https://mysite.dev/search/2)

@saitho saitho marked this pull request as ready for review March 29, 2023 12:37
@3l73 3l73 requested a review from dkd-kaehm March 30, 2023 11:33
Classes/Domain/Search/Uri/SearchUriBuilder.php Outdated Show resolved Hide resolved
Classes/Domain/Search/Uri/SearchUriBuilder.php Outdated Show resolved Hide resolved
When there are route enhancers defined for a page containing
the Solr search plugin, e.g. to realize pretty URLs for the
search term, filters or pagination, there are issues with
the URI caching that utilizes placeholders.

Route Enhancers should specify the expected format using the
requirements setting of the route enhancer parameters. This
will then lead to an exception, which is caught and will then
proceed the URI building with the original arguments instead
of the placeholder arguments.

Resolves: #2984
dkd-friedrich pushed a commit to dkd-friedrich/ext-solr that referenced this pull request Sep 20, 2023
When there are route enhancers defined for a page containing
the Solr search plugin, e.g. to realize pretty URLs for the
search term, filters or pagination, there are issues with
the URI caching that utilizes placeholders.

Route Enhancers should specify the expected format using the
requirements setting of the route enhancer parameters. This
will then lead to an exception, which is caught and will then
proceed the URI building with the original arguments instead
of the placeholder arguments.

Ports: TYPO3-Solr#3562
Resolves: TYPO3-Solr#2984
dkd-friedrich pushed a commit to dkd-friedrich/ext-solr that referenced this pull request Sep 20, 2023
When there are route enhancers defined for a page containing
the Solr search plugin, e.g. to realize pretty URLs for the
search term, filters or pagination, there are issues with
the URI caching that utilizes placeholders.

Route Enhancers should specify the expected format using the
requirements setting of the route enhancer parameters. This
will then lead to an exception, which is caught and will then
proceed the URI building with the original arguments instead
of the placeholder arguments.

Ports: TYPO3-Solr#3562
Resolves: TYPO3-Solr#2984
Copy link
Collaborator

@dkd-kaehm dkd-kaehm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dkd-friedrich dkd-friedrich merged commit ba1de1c into TYPO3-Solr:main Sep 20, 2023
8 checks passed
dkd-friedrich pushed a commit that referenced this pull request Sep 20, 2023
When there are route enhancers defined for a page containing
the Solr search plugin, e.g. to realize pretty URLs for the
search term, filters or pagination, there are issues with
the URI caching that utilizes placeholders.

Route Enhancers should specify the expected format using the
requirements setting of the route enhancer parameters. This
will then lead to an exception, which is caught and will then
proceed the URI building with the original arguments instead
of the placeholder arguments.

Ports: #3562
Resolves: #2984
@dkd-kaehm dkd-kaehm mentioned this pull request Oct 13, 2023
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Configuring tx_solr[q] as speaking URL part crashes faceting
3 participants