bug in index query

This topic contains 3 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 4 years, 6 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #16578
    treehousetim
    treehousetim
    Participant

    I have found and fixed a bug in your indexer.

    file:
    includes/classes/etc/indextable.class.php

    function:
    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) . “‘) )”;

    #16596
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    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 :)


    #16607
    treehousetim
    treehousetim
    Participant

    Hi 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.

    #16613
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    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 :)


Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.