summaryrefslogtreecommitdiffstats
path: root/store/sql_store.go
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2015-10-16 11:17:24 -0400
committerJoramWilander <jwawilander@gmail.com>2015-10-19 09:00:30 -0400
commitf24ea30a75ad52b695f5f275139af1c0495624ac (patch)
tree74ea933bb3e67019a24d168b2f55e61800c1c243 /store/sql_store.go
parent9de8bc4727132f8ec5d67f9d3e8a9642774c296c (diff)
downloadchat-f24ea30a75ad52b695f5f275139af1c0495624ac.tar.gz
chat-f24ea30a75ad52b695f5f275139af1c0495624ac.tar.bz2
chat-f24ea30a75ad52b695f5f275139af1c0495624ac.zip
Refactor to hit database less often.
Diffstat (limited to 'store/sql_store.go')
-rw-r--r--store/sql_store.go9
1 files changed, 1 insertions, 8 deletions
diff --git a/store/sql_store.go b/store/sql_store.go
index a1a542691..c5bf840a1 100644
--- a/store/sql_store.go
+++ b/store/sql_store.go
@@ -32,7 +32,6 @@ import (
const (
INDEX_TYPE_FULL_TEXT = "full_text"
- INDEX_TYPE_PATTERN = "pattern"
INDEX_TYPE_DEFAULT = "default"
)
@@ -376,10 +375,6 @@ func (ss SqlStore) CreateFullTextIndexIfNotExists(indexName string, tableName st
ss.createIndexIfNotExists(indexName, tableName, columnName, INDEX_TYPE_FULL_TEXT)
}
-func (ss SqlStore) CreatePatternIndexIfNotExists(indexName string, tableName string, columnName string) {
- ss.createIndexIfNotExists(indexName, tableName, columnName, INDEX_TYPE_PATTERN)
-}
-
func (ss SqlStore) createIndexIfNotExists(indexName string, tableName string, columnName string, indexType string) {
if utils.Cfg.SqlSettings.DriverName == model.DATABASE_DRIVER_POSTGRES {
@@ -392,8 +387,6 @@ func (ss SqlStore) createIndexIfNotExists(indexName string, tableName string, co
query := ""
if indexType == INDEX_TYPE_FULL_TEXT {
query = "CREATE INDEX " + indexName + " ON " + tableName + " USING gin(to_tsvector('english', " + columnName + "))"
- } else if indexType == INDEX_TYPE_PATTERN {
- query = "CREATE INDEX " + indexName + " ON " + tableName + " (" + columnName + " text_pattern_ops)"
} else {
query = "CREATE INDEX " + indexName + " ON " + tableName + " (" + columnName + ")"
}
@@ -418,7 +411,7 @@ func (ss SqlStore) createIndexIfNotExists(indexName string, tableName string, co
}
fullTextIndex := ""
- if indexType == INDEX_TYPE_FULL_TEXT || indexType == INDEX_TYPE_PATTERN {
+ if indexType == INDEX_TYPE_FULL_TEXT {
fullTextIndex = " FULLTEXT "
}