From 41d2a9f4352b9ee32bfa77da9ffed03b302d1314 Mon Sep 17 00:00:00 2001 From: Chris Duarte Date: Tue, 26 Jun 2018 10:47:39 -0700 Subject: Add Purpose as a searchable field (#8067) * Add Purpose as a searchable field * Add New Index and Remove old for Channels * Include Purpose in FullTextSearch Clause * Move removeIndex for Channels into upgrade.go --- store/sqlstore/channel_store.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'store/sqlstore/channel_store.go') diff --git a/store/sqlstore/channel_store.go b/store/sqlstore/channel_store.go index eb88bc42a..e062d41d1 100644 --- a/store/sqlstore/channel_store.go +++ b/store/sqlstore/channel_store.go @@ -298,7 +298,7 @@ func (s SqlChannelStore) CreateIndexesIfNotExists() { s.CreateIndexIfNotExists("idx_channelmembers_channel_id", "ChannelMembers", "ChannelId") s.CreateIndexIfNotExists("idx_channelmembers_user_id", "ChannelMembers", "UserId") - s.CreateFullTextIndexIfNotExists("idx_channels_txt", "Channels", "Name, DisplayName") + s.CreateFullTextIndexIfNotExists("idx_channel_search_txt", "Channels", "Name, DisplayName, Purpose") } func (s SqlChannelStore) Save(channel *model.Channel, maxChannelsPerTeam int64) store.StoreChannel { @@ -1573,7 +1573,7 @@ func (s SqlChannelStore) SearchMore(userId string, teamId string, term string) s func (s SqlChannelStore) buildLIKEClause(term string) (likeClause, likeTerm string) { likeTerm = term - searchColumns := "Name, DisplayName" + searchColumns := "Name, DisplayName, Purpose" // These chars must be removed from the like query. for _, c := range ignoreLikeSearchChar { @@ -1608,7 +1608,7 @@ func (s SqlChannelStore) buildFulltextClause(term string) (fulltextClause, fullt // Copy the terms as we will need to prepare them differently for each search type. fulltextTerm = term - searchColumns := "Name, DisplayName" + searchColumns := "Name, DisplayName, Purpose" // These chars must be treated as spaces in the fulltext query. for _, c := range spaceFulltextSearchChar { -- cgit v1.2.3-1-g7c22