MySQL error on searching for an entry that hasn't been processed by Publisher...
Got this error while searching for a single term in Low Search. The keyword definitely is represented in the database, but turns out the entry had not been previously edited while Publisher was active (so when you open the entry in CP you only see a 'Save As' option in Publisher bar, rather than 'draft' and 'Save As' options that you get after the entry is entered into the Publisher system.
Editing / saving the entry (even if no changes were made) was sufficient to correct the error - but thought it worth letting you know as it is a pretty severe error.
Using latest versions of Low Search and Publisher on an EE2.11.3 installation.
Error Number: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 3
SELECT 'channel_id', IF(search_results_url='', channel_url, search_results_url) AS url FROM ('exp_channels') WHERE 'channel_id' IN ()
Filename: third_party/low_search/filters/keywords/lsf.keywords.php
Line Number: 1221
Replies
Low 22 Nov 2016 10:25
An edge case, for sure. Publisher is probably setting the array of entries in the channel_entries_query_result hook to an empty array, which in turn causes this. The hook (and therefore the filter methods) should not be called when there are no results to display.
Anyway, this should be fixable in Low Search by opening up ext.low_search.php and look up line #140 which reads
Change that to
and that should fix it. Can you perhaps confirm that it does?
Gavin Lawrie 22 Nov 2016 11:08
OK - thanks! I'll have a go at modifying the code, but first I need to work out how to generate the erroneous entries. I have fixed all the entries I could find, and I am not sure quite how they came to be in the first place, but if I work it out I'll make some more and test the code.