-
Notifications
You must be signed in to change notification settings - Fork 208
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
Change search to use POST instead of GET to accommodate long queries #121
Conversation
I'm not the author of the module but a few things:
|
Agreed. I'll update to make GET the default. |
…default to GET. Set "searchMethod: 'POST'" to use POST in place of GET requests.
I didn't see anyplace to document the new config.json parameter. if "searchMethod": "POST" is added to the the options passed into Client, then searches will use POST, otherwise they will use "GET". I duplicated the existing search tests so that both GET and POST are tested. |
…Component where appropriate
…fault to start Solr.
Is there anything else you need to complete the pull? Chris |
Didn't see this until I already rolled my own. Submitted as PR #129 Guessing that since this has been sitting on ice for a few months there is no plan on supporting this any time soon? Side note: there are now three PRs requesting this feature. Also, regarding GET by default, POST if you want to – I would solidly advocate going the other way around. The folks who are actually interested in logging GETS (i would guess) are substantially less than those who want a reliable search queries. |
I’d really like to see one of these pulled into the main branch, it’s definitely a need for us. I do think that the default needs to be GET to ensure backward compatibility. I put a switch in PR #121 to allow using POST for those who need it. Chris
|
@cbollerud I don't dislike the backwards compatibility, however I think folks are more likely to discover (the hard way) that things randomly stop working when a large query shows up if GET is used by default over POST. Everything maybe working fine until those one or two queries don't go through, and depending on the application, might not get any indication that something went wrong. There's always the possibility of a hybrid automatic approach, that would check the query to see if it's longer than the standard length (say 2048 chars) then automatically use POST instead of GET so prevent a likely failure. Would be pretty easy to do. Regardless, I would love to see search via POST in master in any form I can get it! :D |
I suppose using GET until the search string is over a particular length and then automatically switching to POST could be considered backward compatible. Might be nice to keep the switch as an option as well. I’m fine either way, @lbdremy can make that call. I just would like to see a solution in master. @lbdremy, can you give some feedback? It sounds like Kevin or I could complete the update if that is needed. Chris
|
@cbollerud Just for fun, I rolled that hybrid change up on my branch (#129). Tested on our code base and seems to be working great. Added a configurable option Should be the best of both worlds, while maintaining the set-it-and-forget-it attitude. :) |
Sounds Great!
|
Hi guys, I've ran into the same problem and of course used the same thing (but made it much more lightweight and too opinionated so I won't make a PR out of it, especially since you guys already made 2, and @csabapalfi 1st comment was to-the-point) But that said, I've been looking at the code changes @cbollerud, and it includes a lot of things that I think shouldn't be included into this PR. Allow me to list them:
To summarize, I think your PR is great, but it is including too many things and some design decisions that should be discussed before going into the PR. I am again not a maintainer (yet :)) but I'd suggest doing some clean-up and/or starting discussion about this postDATA thing. Which sound like it should be optional, opt-in and go along with a deprecation for postJSON if needed (but I think postJSON is just fine). Or you could just make |
@kfitzgerald I also like your get_max (although it should probably be named get_max_request_entity_size and commented in the constructor). Could we get something with both of your work into 1 cleaner PR? I hope I'm not stepping out of my turf, but I think it'd be beneficial and easier to get the PR through. |
@nicolasembleton Updated PR #129 per your feedback, and passes CI tests. |
@nicolasembleton @kfitzgerald, this can be closed, right? I think PR #129 implemented the same. |
@luketaverne Correct. Closing as this was already handled by #129 |
HTTP POST for search(select) #110
The code below switches searches to use POST instead of GET, allowing for very long query strings.
It should be trivial to add a switch in search that would allow choosing either option based on either query length or configuration.