ext-solr icon indicating copy to clipboard operation
ext-solr copied to clipboard

[BUG] Plugin "PostBigRequest" has no effect

Open Smove opened this issue 3 years ago • 3 comments

Describe the bug Since TYPO3 has integrated its own EventDispatcher and EventListenerProvider, the plugin "PostBigRequest" no longer has any effect. Problem is, that in the plugin itself in the "initPluginType" function a check of the EventDispatcher for the class from the Symfony components is done and the function for the "PRE_EXECUTE_REQUEST" event is not registered. The plugin "PostBigExtractRequest" throws directly error, because there is no query but simply assumed that the EventDispatcher is compatible. But in TYPO3 Dispatcher the method "addListener" does not exist.

If you register the event of the PostBigRequest itself via a Services.yaml file it works as desired.

To Reproduce Add as many facets as necessary to get over the "GET" parameter limit.

Expected behavior Since MR2476 it should automatically switch a search query to POST. However, this does not happen.

Used versions (please complete the following information):

  • TYPO3 Version: 10.4.32
  • EXT:solr Version: 11.1.2
  • Used Apache Solr Version: 8.9.0
  • PHP Version: 7.4.23

Additional context The following content in your own Services.yaml fixes the problem:

Solarium\Plugin\PostBigRequest:
    tags:
      - name: event.listener
        method: 'preExecuteRequest'
        identifier: 'myext.solr.postbigrequestfix'
        event: Solarium\Core\Event\PreExecuteRequest

Smove avatar Dec 08 '21 09:12 Smove

@Smove thanks for reporting. Please transfer the suggestion to a pull-request.

Affected versions:

  • release-11.1.x
  • release-11.5.x
  • main

dkd-kaehm avatar Dec 08 '21 10:12 dkd-kaehm

Even though above is an example of a solution, I am not sure if this is the best solution. Better would probably be to build some kind of layer in which the functionality from TYPO3 dispatcher and the dispatcher expected in Solarium are combined. This way other plugins are also compatible and not only this one.

Smove avatar Dec 08 '21 10:12 Smove

OK, it seems the POST requests per default are not recommended for Apache Solr see https://github.com/solariumphp/solarium/issues/794#issuecomment-638697548

In general switching to POST should be avoided wherever possible because you (might) bypass all caches.

That feature and other plug-ins MUST be configurable by EXT:solr. So we want to register all the solarium plug-ins(currently only once) via EXT:solr configuration flags only, preferably in site-yaml near to and for each solr connection.


Currently I would propose to revert the #2476 and add a entry with that snipped to the docs in a FAQ part for folks exceeding the GET data.

Affected Versions still remain by https://github.com/TYPO3-Solr/ext-solr/issues/3115#issuecomment-988686912 :

  • release-11.1.x
  • release-11.5.x
  • main

dkd-kaehm avatar Dec 08 '21 18:12 dkd-kaehm

We'll not enable it by default. Who it wants, can enable it in own Services.yaml:

  Solarium\Plugin\PostBigRequest:
    tags:
      - name: event.listener
        method: 'preExecuteRequest'
        identifier: 'myext.solr.postbigrequestfix'
        event: Solarium\Core\Event\PreExecuteRequest

dkd-kaehm avatar Oct 27 '23 17:10 dkd-kaehm