esotalk / esoTalk

Fat-free forum software.
GNU General Public License v2.0
1.47k stars 239 forks source link

create fulltext index of post content #468

Closed mroi closed 7 years ago

mroi commented 7 years ago

Searching within a conversation issues a MATCH clause on the content column (see ETPostModel). However, no fulltext index is configured for content, leading to this database error:

SQL Error (HY000, 1191): Can't find FULLTEXT index matching the column list

Searching over all conversations matches on content and title for which a fulltext index exists. This patch adds a fulltext index for content alone.

mroi commented 7 years ago

I just learned that this problem was likely caused by my web hoster converting my database from MyISAM to InnoDB at some point. Matching on a subset of indexed columns is possible on MyISAM tables, but not on InnoDB tables. Therefore, this patch is more of an InnoDB compatibility fix. Feel free to reject it, if changes for InnoDB support are not desired.

tobyzerner commented 7 years ago

@mroi I suspected that might've been the case, because I've never run into this problem before :) I think because the posts table is hard-coded to be MyISAM, there's no obligation for the fulltext index to be compatible with InnoDB. If someone does tinker and their table ends up as InnoDB, they can also manually add the necessary fulltext index. Thanks for the PR anyway!

mroi commented 7 years ago

I wondered the same thing: someone should have noticed if this was broken. But it did not occur to me until now that the storage backend of the table might be the reason. Sorry for the noise.