fix: refine community cloud search results#402
Merged
Conversation
bb80313 to
47d9b22
Compare
a88af93 to
994c744
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Community Cloud search returned no results for any query (e.g. "woo", "javascript"). Two bugs in
Cloud_API::fetch_search_results:unpack_request_json()returns$json['data'](a bare list), butCloud_Snippetsexpects the full response envelope (it readsdata/snippets,meta,available_filters). So results normalised to an empty set withtotal_snippets: 0.get_featured_snippets()passes the full$jsonand worked — search did not. Fix: pass the full decoded envelope, matching featured (and the 3.9.x behaviour).wp_remote_getused WordPress's 5s default; the cloud search endpoint can take longer on a cold cache, so the request failed with cURL error 28 → empty. Fix: a 15s timeout for the search request.Verification
Against production
codesnippets.cloud: "woo" → 338 results, "javascript" → 12 (was 0/0). Confirmed the request URL/params were already correct and that the cloud API itself returns the expected data — the fault was entirely client-side parsing + timeout.Notes
fix/wp7-admin-ui-compat); the diff here is the single Cloud_API change. Can be rebased ontocore-betato stand alone if preferred.