Theme Directory: Frontend search misses themes with a misdetected index language, and business-model views#730
Closed
obenland wants to merge 1 commit into
Conversation
…th a misdetected language remain findable Jetpack Search queries only locale-specific analyzed fields (title.en, content.en, etc.), selected by the language WP.com detected at index time. That detection is unreliable on short theme descriptions, so themes indexed as non-English have no .en fields and can never match a search on wordpress.org/themes. The .default analyzed fields exist on every document, so appending 'default' to the query languages makes those themes findable again without a reindex. Fixes #8376. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011pfhLmrkpmrMsMMwrZEKJV
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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.
Fixes #8376.
Two query-side fixes for Theme Directory frontend search returning no results; no reindex needed for either.
1. Themes with a misdetected index language are unfindable
Themes like
brandy,amsel, andshadcnare findable via the Themes API but return zero results onhttps://wordpress.org/themes/search/.... Directory search goes through Jetpack Classic Search, which builds its Elasticsearch query only against locale-specific analyzed subfields (title.en,content.en, etc.). WP.com's indexer detects each document's language at index time, and that detection is unreliable on short theme descriptions — roughly 1,300 published themes are currently indexed as non-English (spiking in 2026). Those documents have no.enanalyzed fields at all, only.default, so they can never match.Fix: Filter
jetpack_search_query_languagesto appenddefaultto the query languages. Jetpack'sQuery_Parser::norm_langs()maps any code not in itsavail_langslist todefault, so the query then also targets the.defaultanalyzed fields, which exist on every document regardless of detected language.The filter takes no
WP_Querycontext, but the plugin only loads on the themes site, so no further scoping is needed.2. Searching within the Commercial/Community views returns no results
https://wordpress.org/themes/browse/commercial/?s=shopreturns zero results, whilebrowse/commercial/alone works. Thetheme_business_modeltaxonomy is absent from the site's Elasticsearch index (no documents carrytaxonomy.theme_business_model.slug), so the term filter Jetpack builds from the tax query excludes every document.Fix: Filter
jetpack_search_should_handle_queryto returnfalsefor searches carrying atheme_business_modeltax query, so they fall back to the SQL search path, which already handles the tax filter correctly. This is a workaround until the taxonomy is indexed in ES; the Photo Directory already uses the same filter to opt out of Jetpack Search.Verification
After sandboxing/deploy:
https://wordpress.org/themes/search/brandy/,/amsel/, and/shadcn/each return the theme./photography/still returns ~1,000 results via Jetpack (unchanged counts).multi_matchontitle.en+title.defaultagainstpublic-api.wordpress.com/rest/v1/sites/88381900/searchfinds the affected themes, whiletitle.enalone does not.browse/commercial/?s=shopandbrowse/community/?s=newsreturn results.🤖 Generated with Claude Code
https://claude.ai/code/session_011pfhLmrkpmrMsMMwrZEKJV