Closed ianstewart closed 2 years ago
@gcsecsey using ES can we exclude specific plugins from category searches?
@cpapazoglou we have a ticket where we will implement categories based on categories/tags/taxonomies that are indexed: https://github.com/Automattic/wp-calypso/issues/63167 I'd add this ticket as a follow-up to that because we'll need to see which source cats/tags can we use from both WPORG and WCCOM.
At the moment, the issue of serving categories from ES is planned for a later phase, because we don't yet have even a working MVP for categories, just the search pages. As this issue is considered a bug, I think we should also come up with a temporary solution to blacklist/hide these plugins in Calypso.
We can maintain a blacklist of plugin IDs or plugin slugs, either globally or by category. Then we can add a filter to the ES query to filter out the blacklisted products.
GET jetpack-search-20/_search
{
"query": {
"bool": {
"must": [
{
"term": {
"blog_id": {
"value": "108986944"
}
}
},
{
"term": {
"taxonomy.plugin_section.slug": "featured"
}
}
]
}
},
"fields": [
"title_html", "slug"
],
"_source": false
}
GET jetpack-search-20/_search
{
"query": {
"bool": {
"must": [
{
"term": {
"blog_id": {
"value": "108986944"
}
}
},
{
"term": {
"taxonomy.plugin_section.slug": "featured"
}
}
],
"must_not": [
{
"term": {
"slug": {
"value": "classic-editor"
}
}
}
]
}
},
"fields": [
"title_html", "slug"
],
"_source": false
}
Can we easily make such modifications from Calypso?
Yes, we can definitely filter the results from the client side. My only concern with this would be overfetching, because we'd need to fetch results which won't be ultimately used. However, the current solution uses the default page size of 24 on WPORG.
Since we know that we'll only display 6 results on the section, we can still safely lower this, considering that some results will be filtered on the client.
Yes, we can definitely filter the results from the client side.
By client side, I meant altering the ES query which should respect the pagination - not a JS filter function.
Oh I see, I thought you meant it as a temporary solution until these results are served through ES. It's a good point, after https://github.com/Automattic/wp-calypso/issues/63167 is released, we can update the filters from Calypso! 👍
Diff raised: D90153-code
Changes deployed in r254691-wpcom
If we're featuring our top free plugins, we should curate the list, and feature Classic Editor less prominently in the list.