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

WordPress Trac noreply at wordpress.org
Mon Mar 20 22:45:14 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
--------------------------------------+------------------------------
Changes (by zodiac1978):

 * status:  new => closed
 * resolution:   => maybelater


Comment:

 > Your solution doesn't work when the search term is in both tags and
 content.

 @ravishaheshan That's true. Unfortunately I did not find a simple way to
 achieve this with MySQL below 8.

 Since MySQL 8 there is REPLACE_REGEXP which would solve this:
 https://stackoverflow.com/questions/986826/how-to-do-a-regular-expression-
 replace-in-mysql

 > I'm thinking about adding a post meta field with sanitized
 post_content(w/o block tags and HTML tags) and modifying the search query
 to use that instead of the actual post_content field

 One way of solving this issue is using Relevanssi. It is already doing
 this indexing and is therefore solving this issue too:
 https://wordpress.org/plugins/relevanssi/

 So unless someone finds a way to do this with MySQL below 8 this can be
 closed as "maybelater".

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


More information about the wp-trac mailing list