Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › bug in index query
This topic contains 3 replies, has 2 voices, and was last updated by Ernest Marcinko 5 years, 4 months ago.
- AuthorPosts
- January 31, 2018 at 8:43 pm #16578
I have found and fixed a bug in your indexer.
file:
includes/classes/etc/indextable.class.phpfunction:
private function getPostIdsToIndex() {
the $mimes_restrict variable that holds the where clause is constructed improperly.if ( count($mimes_arr) > 0 )
$mimes_restrict = “AND ( $wpdb->posts.post_mime_type = ” OR $wpdb->posts.post_mime_type IN (‘” . implode(“‘,'”, $mimes_arr) . “‘) )”;the posts table is aliased when the query is created:
FROM $wpdb->posts post
the code should be:
if ( count($mimes_arr) > 0 )
$mimes_restrict = “AND ( post.post_mime_type = ” OR post.post_mime_type IN (‘” . implode(“‘,'”, $mimes_arr) . “‘) )”;February 1, 2018 at 11:10 am #16596Hi,
Thank you very much for letting us know.
It will work both ways, but using the alias is definitely more elegant. I will make sure to implement this to the next upcoming release.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
February 1, 2018 at 4:29 pm #16607Hi Ernest,
It was definitely NOT working. I was finding entries in my error log with the wrong query. When I grabbed the generated query and ran it directly in Sequel Pro on my mac it throws an error.
February 2, 2018 at 10:17 am #16613Hi,
You are right. For some reason it works on my local test server, but looking closer at the code it should not, as that table is used in a left join as well, so the query should not know which one to use within comparision. I guess it either depends on the database version, or some sort of configuration.
Anyways, I will make sure to include the fixed code in the upcoming release.Thank you again for letting me know!
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
You must be logged in to reply to this topic.