1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-04 21:15:24 +02:00

Improve search by tag for MySQL

Fixes #214

MySQL requires specific full text search queries.
This commit is contained in:
Harvey Kandola 2019-02-28 13:39:53 +00:00
parent 4b7d4cf872
commit f47f09661f
4 changed files with 22 additions and 24 deletions

View file

@ -266,6 +266,11 @@ func (s Store) matchFullText(ctx domain.RequestContext, keywords, itemType strin
switch s.Runtime.StoreProvider.Type() {
case env.StoreTypeMySQL:
// Tag names can contain hyphens so we have to wrap text in double quotes
// and then the query parser wraps in single quotes.
if itemType == "tag" {
keywords = fmt.Sprintf("\"%s\"", keywords)
}
fts = " AND MATCH(s.c_content) AGAINST(? IN BOOLEAN MODE) "
case env.StoreTypePostgreSQL:
// By default, we expect no Postgres full text search operators.