Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search box not returning relevant results in FSE themes #62137

Closed
the-misha opened this issue Mar 22, 2022 · 4 comments
Closed

Search box not returning relevant results in FSE themes #62137

the-misha opened this issue Mar 22, 2022 · 4 comments
Labels
[Closed] Fixed Issues explicitly fixed with PRs. Do not use for no longer reproducible issues. [Pri] Normal Schedule for the next available opportuinity. [Status] Core Fix Needed A fix within the Core WordPress or Gutenberg project is required to resolve this issue. [Type] Bug

Comments

@the-misha
Copy link

the-misha commented Mar 22, 2022

Quick summary

Sort order for search results differs between FSE and non-FSE sites. Most relevant results appear at the top for non-FSE sites, but much lower for FSE sites.

Steps to reproduce

  1. Activate a non-FSE theme on site (e.g. Twenty Twenty-One).
  2. Search for something with an unambiguous top result, such as a specific unique post title.
  3. Observe result.
  4. Switch site to an FSE theme (e.g. Kerr).
  5. Search for the same unique post title.

What you expected to happen

Post should appear as the top hit in search results, as on the non-FSE site.

What actually happened

Post appears towards the bottom of the list of search results, below much less relevant results.

Context

Customer report in chat, followed up in ticket.

Simple, Atomic or both?

Simple

Theme-specific issue?

Unknown. Appears to be all FSE themes.

Browser, operating system and other notes

Firefox 98.0, Windows

Reproducibility

Consistent

Severity

Some (< 50%)

Available workarounds?

No but the platform is still usable

Workaround details

A pre_get_posts can be added as a temporary fix (source: WordPress/gutenberg#39285):

add_action(
	'pre_get_posts',
	function( $query ) {
		if ( $query->is_main_query() && $query->is_search() ) {
			$query->set( 'orderby', 'relevance' );
			$query->set( 'order', 'DESC' );
		}
	}
);
@edequalsawesome
Copy link

Looks like this is a core Gutenberg issue! WordPress/gutenberg#39285

@mrfoxtalbot
Copy link

mrfoxtalbot commented Mar 25, 2022

@the-misha, I have taken the liberty to edit your original comment to add a workaround, as it is way more visible there than in a comment.

@cuemarie cuemarie added the [Pri] Normal Schedule for the next available opportuinity. label May 24, 2023
@cuemarie
Copy link

Per WordPress/gutenberg#39285 (comment)

This has been resolved by this PR: WordPress/gutenberg#40656, where we use the global wp_query when we inherit.

📌 ACTIONS

  • Closing as Fixed

@cuemarie cuemarie added [Status] Core Fix Needed A fix within the Core WordPress or Gutenberg project is required to resolve this issue. [Closed] Fixed Issues explicitly fixed with PRs. Do not use for no longer reproducible issues. labels May 24, 2023
@github-actions
Copy link

Support References

This comment is automatically generated. Please do not edit it.

  • 4872709-zen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Closed] Fixed Issues explicitly fixed with PRs. Do not use for no longer reproducible issues. [Pri] Normal Schedule for the next available opportuinity. [Status] Core Fix Needed A fix within the Core WordPress or Gutenberg project is required to resolve this issue. [Type] Bug
Projects
None yet
Development

No branches or pull requests

4 participants