Opened 3 years ago

Last modified 8 months ago

#15249 assigned enhancement

Filtering get_search_sql for advanced queries

Reported by: sc0ttkclark Owned by:
Priority: normal Milestone: Future Release
Component: Plugins Version: 3.1
Severity: normal Keywords: has-patch dev-feedback
Cc:

Description

Currently in the code for 3.1 (trunk) there are no filters running on the new function get_search_sql which would be useful for plugins to perform more complex MySQL functionality on specific columns.

I suggest adding a filter ;)

Attachments (5)

15249.patch (1.8 KB) - added by sc0ttkclark 3 years ago.
Initial Patch including the new filters for Users / Comments
15249.2.patch (954 bytes) - added by sc0ttkclark 2 years ago.
Updated patch for latest SVN Revision (16692)
15249.3.patch (961 bytes) - added by sc0ttkclark 2 years ago.
Updated patch for new $wild var in user get_search_sql
15249.4.patch (1.3 KB) - added by sc0ttkclark 8 months ago.
Refreshing this patch w/ 3.5 trunk
15249.5.patch (1.2 KB) - added by sc0ttkclark 8 months ago.
Changing to use of apply_filters

Download all attachments as: .zip

Change History (15)

At the moment, it appears this function has disappeared from trunk for whatever reason. It's no longer in /wp-includes/classes.php so I'll keep an eye out for where it's being moved to before patching.

  • Type changed from feature request to enhancement

For search, we already have the 'posts_search' filter. Should figure out what to do with that.

In both cases (comment.php / user.php within /wp-includes/), as long as the array passed to get_search_sql is within $this then it can be useful as it is now there is no information available as to what fields are being searched unless the dev copies that code - making it less future proof. Thoughts?

Initial Patch including the new filters for Users / Comments

  • Keywords has-patch needs-review added

Added patch that includes the new filters for Users / Comments - implemented in comment.php and user.php (not within get_search_sql function itself due to the lack of information the function is given like no access to $this)

Updated patch for latest SVN Revision (16692)

Updated patch for new $wild var in user get_search_sql

comment:7   dd322 years ago

  • Keywords 3.2-early added
  • Milestone changed from Awaiting Review to Future Release

All the Search SQL's should have consistent filters to allow for other search engines to be droped in amongst other things.

This needs a review to ensure that all required locations are changed.

  • Owner scribu deleted
  • Status changed from new to assigned

Refreshing this patch w/ 3.5 trunk

  • Keywords dev-feedback added; needs-review 3.2-early removed

Refreshed the patch on this ticket for 3.5

Related: #21803

Changing to use of apply_filters

Note: See TracTickets for help on using tickets.