• Resolved mats53

    (@mats53)


    Hi!
    I used the shortcode [my_calendar_search] to place a searchbox below the calendar. This worked well on my localhost testsite, but when I installed My Calendar on the site that I am working on for an update, it returns no results.
    In both cases My Calendar 3.1.12 is used but:
    the testsite is WP 5.1.1 and the sharp site is WP 5.2
    and testsite is on PHP Version: 5.6.15 while the sharp site is PHP Version: 7.2.17-0ubuntu0.18.04.1

    The Widget, Simple search, gives the same problem.

    Have I stumbled on a bug or am I making some stupid mistake.
    /Mats

    The page I need help with: [log in to see the link]

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Joe Dolson

    (@joedolson)

    Neither the WordPress version nor the PHP version should make a difference, although I can’t totally guarantee that.

    What could make a difference would be MySQL version and collation; are those different between the two sites?

    Thread Starter mats53

    (@mats53)

    For the testversion i got:
    ==Extra info:==
    PHP Version: 5.6.15
    DB Version: 5.5.5
    Server Software: Apache/2.4.17 (Win32) OpenSSL/1.0.2d PHP/5.6.15
    User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36

    and the sharp version:
    ==Extra info:==
    PHP Version: 7.2.17-0ubuntu0.18.04.1
    DB Version: 5.5.63
    Server Software: Apache/2.4.29 (Ubuntu)
    User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36

    there are also different Themes.

    I also made a test by placing an Echo of the $search in ‘function mc_get_search_results’ line ~411 and got:
    On testsite: AND ( event_title LIKE ‘%soppa%’ OR event_desc LIKE ‘%soppa%’ OR event_short LIKE ‘%soppa%’ OR event_label LIKE ‘%soppa%’ OR event_city LIKE ‘%soppa%’ OR event_postcode LIKE ‘%soppa%’ OR event_registration LIKE ‘%soppa%’ )

    and on the sharp site: AND MATCH(event_title,event_desc,event_short,event_label,event_city,event_postcode,event_registration) AGAINST ( ‘soppa’ IN BOOLEAN MODE )

    (Search word is Soppa (swedish for Soup)

    /Mats

    Plugin Author Joe Dolson

    (@joedolson)

    So both sites are on pretty old versions of MySQL (5.5 hit end of life in December 2018), but that’s not a key difference between them.

    However, the query difference is striking – the test site is running a non-boolean query while the main site is attempting a boolean query. That means that the site believes that your database is a MyISAM database.

    Is the live database actually MyISAM, while the other isn’t?

    Thread Starter mats53

    (@mats53)

    It seems that the My Calendar tables are InnoDB on both sites, but most of the other tables are MyISAM.

    Both sites seems to be InnoDB as standard engine, but I have little control of the live site, so I am not sure about that.

    /Mats

    Plugin Author Joe Dolson

    (@joedolson)

    So, My Calendar assumes MyISAM if the query to check the table status does not return results. Perhaps the production server isn’t allowing the ‘SHOW TABLE STATUS’ query, so My Calendar doesn’t get the value.

    Are you able to check that possibility?

    Thread Starter mats53

    (@mats53)

    Hi again,

    I was able to run the ‘SHOW TABLE STATUS’ on both servers, so I guess that is not the problem.

    Plugin Author Joe Dolson

    (@joedolson)

    Your being able to run the query doesn’t ensure that WordPress can do it; that would depend on the permissions that the MySQL user credentials used by WordPress has. Did you verify that from within WordPress or externally?

    Thread Starter mats53

    (@mats53)

    Hi again!

    You are right, i did this by running a query from external programs (phpMyAdmin for the local, and MySQLWorkbench for the sharp).

    So I made a new test. I Placed this code at line 405 in my-calendar-events.php:
    $my_calendar = my_calendar_table();
    $dbs = $wpdb->get_results( $wpdb->prepare( ‘SHOW TABLE STATUS WHERE name=%s’, $my_calendar ) );
    print_r($dbs);

    And got the following outputs:
    Working testsite:
    Array ( [0] => stdClass Object ( [Name] => wp_1my_calendar [Engine] => InnoDB [Version] => 10 [Row_format] => Compact [Rows] => 4 [Avg_row_length] => 4096 [Data_length] => 16384 [Max_data_length] => 0 [Index_length] => 16384 [Data_free] => 0 [Auto_increment] => 5 [Create_time] => 2019-03-15 10:40:49 [Update_time] => [Check_time] => [Collation] => utf8mb4_unicode_ci [Checksum] => [Create_options] => [Comment] => ) )

    Not working production site:
    Array ( [0] => stdClass Object ( [Name] => wp_1my_calendar [Engine] => InnoDB [Version] => 10 [Row_format] => Compact [Rows] => 65 [Avg_row_length] => 756 [Data_length] => 49152 [Max_data_length] => 0 [Index_length] => 16384 [Data_free] => 5242880 [Auto_increment] => 63 [Create_time] => 2019-05-09 14:42:19 [Update_time] => [Check_time] => [Collation] => utf8mb4_unicode_ci [Checksum] => [Create_options] => [Comment] => ) )

    Plugin Author Joe Dolson

    (@joedolson)

    What does the function mc_get_db_type() return in each installation?

    It could be that the database type has changed. The value of mc_get_db_type() is cached for 30 days, so if the database type changed after installation, then it could result in that not being correct.

    Thread Starter mats53

    (@mats53)

    The testsite (working) says InnoDB.
    The production site (not working) says MyISAM.

    Plugin Author Joe Dolson

    (@joedolson)

    Then that sounds like the dB type changed, but the function doesn’t know it. There’s a transient storing that value for 30 days; if you delete the transient option, it should go back to normal.

    Thread Starter mats53

    (@mats53)

    Hi again!

    Sorry for late respons, but have been out of touch for a while.

    You, were right, of course. I found that transient and deleted it and that was it.

    Thanks a lot for great support.

    /Mats

    Plugin Author Joe Dolson

    (@joedolson)

    Glad to hear it!

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘Search problem’ is closed to new replies.