A TYPO3 extension that integrates the Apache Solr search server with TYPO3 CMS. dkd Internet Service GmbH is developing the extension. Community contributions are welcome. See CONTRIBUTING.md for details.
GNU General Public License v3.0
137
stars
252
forks
source link
[FEATURE] Add option to completely remove query-string from SearchRequest #4135
Is your feature request related to a problem? Please describe.
Removing the query-string from a SearchRequest might be used to keep e.g. the category selections while not limiting the result by a search query string anymore.
In solr v11.2 it was possible to completely remove the query-string from a SearchRequest by setting it to null.
Describe the solution you'd like
Introduce a new method that removes the query-string from SearchRequest.
Describe alternatives you've consideredAlternative A:
Allow null as argument for the method:
public function setRawQueryString(string|null $rawQueryString = ''): SearchRequest
Alternative B:
Set query string to empty string …->setRawQueryString(''):
But this will result in an unnecessary empty query-string in the url:
https://example.com/search/?tx_solr[filter][0]=altType%3ASomeCategory&tx_solr[q]=
Additional context
Completely removing the SearchRequest is afaik only usefull with allowEmptyQuery set in TS-config:
Is your feature request related to a problem? Please describe. Removing the query-string from a
SearchRequest
might be used to keep e.g. the category selections while not limiting the result by a search query string anymore.In solr v11.2 it was possible to completely remove the query-string from a
SearchRequest
by setting it tonull
.E.g. using a custom ViewHelper:
Introduced in solr v11.5 by https://github.com/TYPO3-Solr/ext-solr/commit/61076e3ed99ba2c4b9f17d44c2e50f278218780d the method
SearchRequest::setRawQueryString(string $rawQueryString = '')
enforces a string. Thereby it is no longer possible to set the query-string tonull
.https://github.com/TYPO3-Solr/ext-solr/blob/dfcdd98bbbac58678cdb9bb0e07eef28329c6556/Classes/Domain/Search/SearchRequest.php#L436-L439
Describe the solution you'd like Introduce a new method that removes the query-string from
SearchRequest
.Describe alternatives you've considered Alternative A: Allow
null
as argument for the method:Alternative B: Set query string to empty string
…->setRawQueryString('')
:But this will result in an unnecessary empty query-string in the url:
https://example.com/search/?tx_solr[filter][0]=altType%3ASomeCategory&tx_solr[q]=
Additional context Completely removing the
SearchRequest
is afaik only usefull withallowEmptyQuery
set in TS-config:Target versions