[wp-trac] [WordPress Trac] #56294: WordPress search finds block name in comment

WordPress Trac noreply at wordpress.org
Tue Mar 21 14:09:19 UTC 2023


#56294: WordPress search finds block name in comment
--------------------------------------+------------------------------
 Reporter:  zodiac1978                |       Owner:  (none)
     Type:  enhancement               |      Status:  closed
 Priority:  normal                    |   Milestone:  Awaiting Review
Component:  Database                  |     Version:  5.0
 Severity:  normal                    |  Resolution:  maybelater
 Keywords:  needs-patch dev-feedback  |     Focuses:  performance
--------------------------------------+------------------------------

Comment (by zodiac1978):

 > But by default, it doesn't remove Gutenberg annotations from the content

 IIRC Relevanssi is building an index and this does not contain those
 comments. The content itself is untouched, and the search is not using the
 content anymore, but the index.

 In my tests I couldn't find block names with Relevanssi used.

 At the moment I try to get this at least working with MySQL 8.0.4 or above
 (where REGEXP_REPLACE was introduced), but couldn't get this to work. My
 latest try:

 {{{
 $where .= " AND REGEXP_REPLACE({$wpdb->posts}.post_content,
 '\<\!\-\-.*?\-\-\>', '') LIKE '%{$search_query}%'";
 }}}

 This does not throw any error but is still not working ... :(

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56294#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list