Wednesday, July 24, 2013

bug fixes to audio search

V had come over for Gurupoornima, and kindly helped bug-fix the radiosai audio search results page.

The first bug was displayed when searching for Discourses: if the description is exactly the same, in the search result, only one of the DDs is displayed, even though there are two different versions in different languages. Solution was simple - changed line

$dataQuery.= " group by description ";
to
$dataQuery.= " group by description, language ";

The next bug was harder. If the search result had a very large number of files within a single line, i.e. with the same description, clicking the download button used to fail, or give a truncated list. Checking out the database calls one by one by giving echo statements, V found that the truncation was happening at the group_concat sql command. Apparently mysql has a group_concat default size limit of 1 kB. The blob returned is truncated to 1024 bytes. Googling found the answer. Since we don't have system-wide access on that server, we had to change the size limit for the particular session. Just adding the line

$inc_result= mysql_query("SET @@group_concat_max_len = 512000;");

just before the relevant queries were fired did the trick. The @@ means for this session.

No comments:

Post a Comment