How to configure Solarium to use POST instead of GET Requests

对着背影说爱祢 提交于 2019-12-11 06:02:36

问题


im facing the problem that our uri's sent to solr (jetty) are getting to long, way over 9k bytes which exceeds the default limit by jetty.

the solution would be to switch from GET requests to POST requests because we do not want to increase the requestHeaderSize jetty can accept.

so while upgrading the project we also switched to solarium as php solr client. now the question is what is the correct way to set POST as default method or on a request basis and on what level does that happen? solr client or request or something else?

help is much appreciated.


回答1:


You can use the bundled PostBigRequest plugin. It'll allow you to either use a limit before the request is switched to a POST request, or send all requests as POST requests. If you don't have a specific need to use GET requests (for example caching if you have a reverse proxy such as varnish present), you can switch all your requests to POST requests.

// create a client instance and autoload the postbigrequest plugin
$client = new Solarium\Client($config);
$client->getPlugin('postbigrequest');


来源:https://stackoverflow.com/questions/57198367/how-to-configure-solarium-to-use-post-instead-of-get-requests

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!