This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

bug in index query

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #16578
    treehousetimtreehousetim
    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 MarcinkoErnest 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.

    #16607
    treehousetimtreehousetim
    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 MarcinkoErnest 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!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.