8000 Introduce method to remove the query-string from search-request by rr-it · Pull Request #4136 · TYPO3-Solr/ext-solr · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Introduce method to remove the query-string from search-request #4136

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

Merged

Conversation

rr-it
Copy link
Contributor
@rr-it rr-it commented Aug 19, 2024

What this PR does

This introduce a new method that removes the query-string from SearchRequest. Other active filters e.g. selected categories are not removed from SearchRequest.

This is especially usefull when allowEmptyQuery is set in TS-config:

plugin.tx_solr {
  search {
    query {
      allowEmptyQuery = 1
    }
}

How to test

This can be used in a custom ViewHelper:

class RemoveQueryViewHelper extends AbstractUriViewHelper
{

    /**
     * @param array $arguments
     * @param \Closure $renderChildrenClosure
     * @param RenderingContextInterface $renderingContext
     * @return string
     */
    public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
    {
        $newRequest = static::getUsedSearchRequestFromRenderingContext($renderingContext)
            ->getCopyForSubRequest()
            ->removeQueryString();
        $uri = self::getSearchUriBuilder($renderingContext)->getCurrentSearchUri($newRequest);
        return $uri;
    }
}

Fixes: #4135

AC87
@dkd-kaehm dkd-kaehm force-pushed the feature/searchrequest-remove-query-string branch from f646ae7 to 4f08447 Compare November 1, 2024 07:36
@dkd-kaehm dkd-kaehm merged commit b0ddab0 into TYPO3-Solr:main Nov 1, 2024
6 checks passed
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.

[FEATURE] Add option to completely remove query-string from SearchRequest
2 participants
0