wpdir icon indicating copy to clipboard operation
wpdir copied to clipboard

Missing matches within an otherwise correct result

Open johnbillion opened this issue 5 years ago • 5 comments

When searching plugins for wp_unschedule_hook (https://wpdirectory.net/search/01EXFTWBF5AXT8WX8JBYBRR9KC) the top result is for WP-Optimize. Only one match is shown, however the plugin contains three matches.

Screenshot from searching the plugin with a code editor:

johnbillion avatar Feb 01 '21 22:02 johnbillion

This is a very useful report- thank you @johnbillion .

I have been looking into this and wpdir has the latest plugin's code 3.6.1, which has the backward-compatibility-functions.php file with the two uses of wp_unschedule_hook. I cannot see an obvious reason why wpdir does not show the two matches from that file. Do you have any idea why it might not be matching?

I will need to debug further, seeing the output when it indexes and searches the plugin- which I might not be able to do until this weekend. I will let you know what I find.

PeterBooker avatar Feb 02 '21 22:02 PeterBooker

Quick update. I failed to find the root cause this weekend.

I managed to setup a fresh local version of wpdir with just the latest version of the WP-Optimize plugin and it had the same issue above (it does correctly tri-gram index the file, it does correctly work out it needs to search the file and it ran the regex search properly). My next step is to look into whether there is some form of character encoding difference.

PeterBooker avatar Feb 07 '21 23:02 PeterBooker

Looks like the problem isn't confined to that file. Example: https://wpdirectory.net/search/01EXZCZ5E6GVYRY4YC8VCBM4SM (tenth result).

wp_normalize_path is found within wp-optimize.php but not within includes/backward-compatibility-functions.php or includes/class-updraft-smush-task.php.

johnbillion avatar Feb 07 '21 23:02 johnbillion

I have been out most of the weekend so didn't get much time to continue with this, but I have a quick update.

I finally (props @Clorith ) discovered the reason wpdir was no longer running on Linux- I needed to raise vm.max_map_count. This has allowed me to migrate the service off my Windows PC and back onto a Linux server tonight. I had hoped this might have an impact but I still get the same problems above.

I tried a little more troubleshooting and even running regex searches manually in Go on the includes/backward-compatibility-functions.php file I cannot get matches for wp_unschedule_hook , even when using wp_[a-z]+_hook, which is rather concerning. I will continue to look into what makes this file (and obviously others) different.

PeterBooker avatar Feb 14 '21 22:02 PeterBooker

This might be too obvious, and I don't know Go enough to check myself, but I assume multiline match regexs are being used? (the m flag)

ethicalhack3r avatar Feb 15 '21 09:02 ethicalhack3r