Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Nobody loves the native search

Nobody loves the native search

You can search on the frontend and on the backend of WordPress, but this search is … simple.

It is just a full text SQL search. It lacks many features, like highlighting, synonyms, phrase search, etc. And many page builders, even the block editor, create more problems.

The search doesn’t work at all or there are too many “false positive” search results.

Let’s take a deep dive and find out what is broken and how to fix it!

Further details: https://torstenlandsiedel.de/wceu2024/

Lightning Talk at WordCamp Europe 2024 in Turino

Torsten Landsiedel

June 25, 2024
Tweet

More Decks by Torsten Landsiedel

Other Decks in Programming

Transcript

  1. Where and what does WordPress not search? ➔ Categories, Tags,

    Custom Taxonomies ➔ Custom Fields ➔ Comments ➔ Widgets ➔ Slugs ➔ Authors #WCEU
  2. Too many results … The story of looking for a

    syntax highlighting extension on a blog of a friend. #WCEU
  3. False positives <!-- wp:syntaxhighlighter/code {"language":"php"} --> <pre class="wp-block-syntaxhighlighter-code"> function wp_example(

    ) { echo ‘Hello WC Europe!’; } add_filter( 'wp_footer', wp_example );</pre> <!-- /wp:syntaxhighlighter/code --> #WCEU
  4. Content, not markup <!-- wp:syntaxhighlighter/code {"language":"php"} --> <pre class="wp-block-syntaxhighlighter-code"> function

    wp_example( ) { echo ‘Hello WC Europe!’; } add_filter( 'wp_footer', wp_example );</pre> <!-- /wp:syntaxhighlighter/code --> #WCEU
  5. “Unfortunately, this is a known issue in WordPress […], if

    you search for "table", you'll get results including <table> tags. ” #WCEU
  6. “If you require 100% accurate search results, the best option

    is to use a dedicated search engine, like Elasticsearch. ” - Gary Pendergast #WCEU
  7. “One opportunity is for [...] search backends to render blocks

    fully before sending post_content into the index. #WCEU
  8. #WCEU “I don't have any great ideas for how to

    resolve this with MySQL. I'd love to hear of a solution if someone has one.” - Daniel Bachhuber
  9. RegEx will have a performance impact. A better solution would

    be a separate index. Performance? #WCEU
  10. Ignoring the complete markup? What about filenames or alternative text?

    What about shortcodes? What about backward compatibility? What about non encoded characters? What about JSON? #WCEU
  11. Missing maintenance The search is a fundamental feature, but it

    is lacking innovation and extensibility in core. #WCEU
  12. Missing tools “The software should provide a framework for translation

    to make it globally accessible to speakers of all languages.“ (WordPress Foundation) - but we are missing safeguards for settings hidden in the translation #WCEU
  13. Missing settings Sometimes we overrate “Decisions, not options” and should

    give users a choice. Basic settings for SEO, sitemaps or search would be helpful. #WCEU
  14. ➔ Let’s add more features to the internal search ➔

    Let’s add very basic search settings ➔ Let’s add safeguards for translation settings (like the stop word list) - check your locale! I need your help! #WCEU