austins / Vanilla-App-Articles

Provides a way to publish articles with Vanilla Forums.
https://open.vanillaforums.com/addon/articles-application
GNU General Public License v2.0
11 stars 2 forks source link

Search Functionality Broken #53

Closed austins closed 9 years ago

austins commented 9 years ago

Enabling Articles 1.0.0 on Vanilla 2.1.11 breaks search functionality and causes this error to show up:

PDO Statement failed to prepare|Gdn_Database|Query|The used SELECT statements have a different number of columns

Upon disabling the application, search functionality works again.

See: http://vanillaforums.org/discussion/30318/articles-breaks-search-function

austins commented 9 years ago

Closed by bee3b69c3723c949c2213537ce4cc8124877f83b. The error is gone now.

Apparently, SearchModel requires that search base queries, constructed in ArticleSearchModel within the ArticleSql and ArticleCommentSql methods, have the same number of columns for the SELECT statement as the numbers of columns that are selected in Vanilla's discussion and comment search queries. This is because SearchModel does a UNION of all the search queries, which requires the same number of columns for all SELECT statements that are unified.

To fix this, I just added one more column to the SELECT statement in each of the methods.