-
Notifications
You must be signed in to change notification settings - Fork 27
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
WIP: Experiment: Advanced search qualifiers #87
base: trunk
Are you sure you want to change the base?
Conversation
source/wp-content/themes/wporg-developer/inc/advanced-search-filters.php
Outdated
Show resolved
Hide resolved
if ( str_contains( $s, '(' ) ) { | ||
// Modify the search query to omit the parentheses. | ||
$keyword = rtrim( $keyword, '()' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh.. Well this breaks some of this code :D
I guess I should've done this instead, @StevenDufresne does my change look proper this time?
if ( str_contains( $s, '(' ) ) { | |
// Modify the search query to omit the parentheses. | |
$keyword = rtrim( $keyword, '()' ); | |
if ( str_contains( $s, '(' ) ) { | |
// Modify the search query to omit the parentheses. | |
$keyword = str_replace( array( '()', '(' ), '', $keyword ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the code to use the str_replace
again. It appears to work. 👍
c671123
to
3d2c2f4
Compare
I think this works well, the only problem I don't have a solution for is that the search query and the filter boxes can fall out of sync seeing that we don't automatically append the advanced search qualifiers when using the filter boxes. For example:
It will apply the filter but the search keyword will still be I don't think we want to add/remove to the searchbox everytime a checkbox is clicked though... 🤔 |
Mentioned in: meta:3158.
Allow some basic search qualifiers to make searching a little bit more powerful.
Filter by type:
You can combine multiple types to filter.
type:hook
type:function
type:method
type:class
Filter by file:
You can filter within 1 or more files. Will match partial paths. Uses
name__like
.file:wp-settings.php
Filter by version:
You can filter within 1 version. Must be a full version.
version:4.8.0
Examples:
Search:
version:4.8.0 file:class-wp-editor.php get
See version
4.8.0
, file:class-wp-editor.php
, looking for functions that haveget
in them.Returns: