Skip to content

Search: Add instant search auto config#15026

Merged
gibrown merged 3 commits intoadd/search-planfrom
add/instant-search-auto-config
Mar 24, 2020
Merged

Search: Add instant search auto config#15026
gibrown merged 3 commits intoadd/search-planfrom
add/instant-search-auto-config

Conversation

@gibrown
Copy link
Copy Markdown
Member

@gibrown gibrown commented Mar 17, 2020

For a number of cases we should do some version of auto config on the instant search widgets to improve the initial UX.

Cases this handles:

  • no jp search widgets in the overlay or sidebar-1
  • if the theme has sidebar-1 then adds the preconfigured widget and replaces the core search widget if it exists.
  • if the theme has no sidebar then only add it to the overlay
  • jp search widget in sidebar but not overlay: copy settings from the sidebar widget into the overlay
  • if there is a jp search widget in the overlay: do nothing

The default settings for the widget are look at the post types on the site and registered taxonomies in addition to tags, categories, and year.

The trigger for the auto config is currently just a hacky query string: /wp-admin/?jpsearch_autoconfig. I am not sure what this should get hooked up to. Currently there is no nonce and we probably need to hook it up to something else. It may need to be tied into the onboarding/post-purchase flow though so maybe we should merge this into the feature branch as is for now?

@gibrown gibrown added [Status] Needs Review This PR is ready for review. [Feature] Search For all things related to Search Instant Search labels Mar 17, 2020
@gibrown gibrown added this to the InstantSearchLaunch milestone Mar 17, 2020
@gibrown gibrown requested review from a team, AnnaMag, jsnmoon and keoshi March 17, 2020 22:25
@gibrown gibrown self-assigned this Mar 17, 2020
@matticbot
Copy link
Copy Markdown
Contributor

Caution: This PR has changes that must be merged to WordPress.com
Hello gibrown! These changes need to be synced to WordPress.com - If you 're an a11n, please commandeer, review, and approve D40468-code before merging this PR. Thank you!

@jsnmoon
Copy link
Copy Markdown
Contributor

jsnmoon commented Mar 20, 2020

I'm concerned about the implicit nature of our auto-configuration adversely affecting the new customer experience. Could we possibly simplify our approach to the following?

  1. If there's a Jetpack Search widget in the sidebar but none in the overlay, duplicate the sidebar widget into the overlay.
  2. If there's no Jetpack Search widget in the overlay, add it.
  3. Always perform the auto-configuration in the init hook, like register_jetpack_instant_sidebar.

Given that we already create the Overlay Sidebar on behalf of the user, performing an automated action onto the sidebar seems reasonable.

Also, I think we could merge this branch into master directly. There's no other change staged on instant-search-master.

@gibrown
Copy link
Copy Markdown
Member Author

gibrown commented Mar 20, 2020

If there's a Jetpack Search widget in the sidebar but none in the overlay, duplicate the sidebar widget into the overlay.
If there's no Jetpack Search widget in the overlay, add it.

It should be doing both of these already (when the query param is present).

Always perform the auto-configuration in the init hook, like register_jetpack_instant_sidebar.

The register function only puts the info into php global variables. Adding the widgets adds them to the DB can we can't do DB writes on every page load.

Also, I think we could merge this branch into master directly. There's no other change staged on instant-search-master.

Ah, good point. I think that this should then get combined into #15074 since that is adding an api call for actually triggering the auto config. @AnnaMag was going to take a look at that code to clean up my hackiness and see if that approach makes sense.

So Calypso will make three api calls after purchase:

  • turn on search module
  • turn on instant search
  • trigger the auto config

Then it will redirect to show the thank you banner in wp-admin.

Does that UX make sense to you @keoshi and @jsnmoon ?

@jsnmoon
Copy link
Copy Markdown
Contributor

jsnmoon commented Mar 23, 2020

So Calypso will make three api calls after purchase:

  • turn on search module
  • turn on instant search
  • trigger the auto config

Then it will redirect to show the thank you banner in wp-admin. @gibrown

Yup, sounds good! 👍

@gibrown gibrown changed the base branch from instant-search-master to add/search-plan March 24, 2020 01:54
@gibrown gibrown added [Status] In Progress and removed [Status] Needs Review This PR is ready for review. labels Mar 24, 2020
@gibrown
Copy link
Copy Markdown
Member Author

gibrown commented Mar 24, 2020

Gah... i need to rebase this onto add/search-plan but it is a mess....

@keoshi
Copy link
Copy Markdown
Contributor

keoshi commented Mar 24, 2020

So Calypso will make three api calls after purchase:

  • turn on search module
  • turn on instant search
  • trigger the auto config

Then it will redirect to show the thank you banner in wp-admin.

Yep, perfect! 🌟

@gibrown gibrown force-pushed the add/instant-search-auto-config branch from dfc6096 to 26f4e17 Compare March 24, 2020 20:10
@gibrown
Copy link
Copy Markdown
Member Author

gibrown commented Mar 24, 2020

Rebased this and removed the query param for triggering it so we can use an API. Merging this so we can focus separately on how we want to trigger things.

@gibrown gibrown merged commit bf2d342 into add/search-plan Mar 24, 2020
@gibrown gibrown deleted the add/instant-search-auto-config branch March 24, 2020 20:17
gibrown added a commit that referenced this pull request Mar 30, 2020
* Search: Add Search plan to wp-admin Plans/My-Plans pages (#15011)
* Add Instant Search feature gate
* Add Jetpack Search to the Plans page
* Instant Search: Add support in glance and performance sections (#15043)
* Search: Add instant search auto config (#15026)
* Significant refactoring of Plans pages, especially for Backups
* Update the copy for search module. (#15123)
* Search: Add search plan to my-plans page (#15095)
* Search: Add pricing and tier information to Plans page (#15125)
* Search: Fix search plan detection (#15156)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Search For all things related to Search

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants