Skip to content

Theme Directory: Searching within the Commercial/Community views returns no results#732

Open
obenland wants to merge 1 commit into
WordPress:trunkfrom
obenland:fix/theme-directory-business-model-search
Open

Theme Directory: Searching within the Commercial/Community views returns no results#732
obenland wants to merge 1 commit into
WordPress:trunkfrom
obenland:fix/theme-directory-business-model-search

Conversation

@obenland

Copy link
Copy Markdown
Member

See #8376.

Problem

https://wordpress.org/themes/browse/commercial/?s=shop returns zero results, while browse/commercial/ alone works fine (same for browse/community/). The theme_business_model taxonomy is absent from the site's Elasticsearch index — no documents carry taxonomy.theme_business_model.slug — so the term filter Jetpack Search builds from the tax query excludes every document.

The taxonomy is missing because WP.com's indexing pipeline strips any taxonomy not in the Jetpack_Sync_Module_Search::taxonomies allowlist at document build time. The plugin_* taxonomies are in that list (which is how Plugin Directory search works); theme_business_model is not.

Temporary fix

Filter jetpack_search_should_handle_query to return false for searches carrying a theme_business_model tax query, so they fall back to the SQL search path, which already applies the tax filter correctly. The Photo Directory uses the same filter to opt out of Jetpack Search.

This is a workaround: the proper fix is adding theme_business_model to the WP.com-side taxonomy allowlist and bulk-reindexing the themes site, after which this filter should be reverted so these searches get ES relevance again.

Verification

After sandboxing/deploy:

  • browse/commercial/?s=shop and browse/community/?s=news return results.
  • A plain /themes/search/shop/ still uses Jetpack Search (unchanged counts).

🤖 Generated with Claude Code

https://claude.ai/code/session_011pfhLmrkpmrMsMMwrZEKJV

…ity views

The theme_business_model taxonomy is absent from the site's Elasticsearch
index, so the term filter Jetpack Search builds from the tax query excludes
every document and searches like browse/commercial/?s=shop return no
results. Opting these queries out via jetpack_search_should_handle_query
lets them use the SQL search path, which already handles the tax query
correctly, until the taxonomy is indexed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011pfhLmrkpmrMsMMwrZEKJV
Copilot AI review requested due to automatic review settings July 23, 2026 14:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown

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 props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props obenland.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants