diff options
-rw-r--r-- | database/sql.go | 4 | ||||
-rw-r--r-- | database/sql/schema_version_20.sql | 2 | ||||
-rw-r--r-- | storage/entry.go | 6 |
3 files changed, 6 insertions, 6 deletions
diff --git a/database/sql.go b/database/sql.go index be033fb..817feba 100644 --- a/database/sql.go +++ b/database/sql.go @@ -142,7 +142,7 @@ alter table users add column extra hstore; create index users_extra_idx on users using gin(extra); `, "schema_version_20": `alter table entries add column document_vectors tsvector; -update entries set document_vectors = to_tsvector(title || ' ' || coalesce(content, '')); +update entries set document_vectors = to_tsvector(substring(title || ' ' || coalesce(content, '') for 1000000)); create index document_vectors_idx on entries using gin(document_vectors);`, "schema_version_21": `alter table feeds add column user_agent text default '';`, "schema_version_3": `create table tokens ( @@ -192,7 +192,7 @@ var SqlMapChecksums = map[string]string{ "schema_version_18": "c0ec24847612c7f2dc326cf735baffba79391a56aedd73292371a39f38724a71", "schema_version_19": "a83f77b41cc213d282805a5b518f15abbf96331599119f0ef4aca4be037add7b", "schema_version_2": "e8e9ff32478df04fcddad10a34cba2e8bb1e67e7977b5bd6cdc4c31ec94282b4", - "schema_version_20": "6c4e9b2c5bccdc3243c239c390fb1caa5e15624e669b2c07e14c126f6d2e2cd6", + "schema_version_20": "5d414c0cfc0da2863c641079afa58b7ff42dccb0f0e01c822ad435c3e3aa9201", "schema_version_21": "77da01ee38918ff4fe33985fbb20ed3276a717a7584c2ca9ebcf4d4ab6cb6910", "schema_version_3": "a54745dbc1c51c000f74d4e5068f1e2f43e83309f023415b1749a47d5c1e0f12", "schema_version_4": "216ea3a7d3e1704e40c797b5dc47456517c27dbb6ca98bf88812f4f63d74b5d9", diff --git a/database/sql/schema_version_20.sql b/database/sql/schema_version_20.sql index 228e162..18461b8 100644 --- a/database/sql/schema_version_20.sql +++ b/database/sql/schema_version_20.sql @@ -1,3 +1,3 @@ alter table entries add column document_vectors tsvector; -update entries set document_vectors = to_tsvector(title || ' ' || coalesce(content, '')); +update entries set document_vectors = to_tsvector(substring(title || ' ' || coalesce(content, '') for 1000000)); create index document_vectors_idx on entries using gin(document_vectors);
\ No newline at end of file diff --git a/storage/entry.go b/storage/entry.go index ff081d4..5aa8b45 100644 --- a/storage/entry.go +++ b/storage/entry.go @@ -50,7 +50,7 @@ func (s *Storage) UpdateEntryContent(entry *model.Entry) error { query := ` UPDATE entries - SET document_vectors = to_tsvector(title || ' ' || coalesce(content, '')) + SET document_vectors = to_tsvector(substring(title || ' ' || coalesce(content, '') for 1000000)) WHERE id=$1 AND user_id=$2 ` _, err = tx.Exec(query, entry.ID, entry.UserID) @@ -68,7 +68,7 @@ func (s *Storage) createEntry(entry *model.Entry) error { INSERT INTO entries (title, hash, url, comments_url, published_at, content, author, user_id, feed_id, document_vectors) VALUES - ($1, $2, $3, $4, $5, $6, $7, $8, $9, to_tsvector($1 || ' ' || coalesce($6, ''))) + ($1, $2, $3, $4, $5, $6, $7, $8, $9, to_tsvector(substring($1 || ' ' || coalesce($6, '') for 1000000))) RETURNING id, status ` err := s.db.QueryRow( @@ -107,7 +107,7 @@ func (s *Storage) updateEntry(entry *model.Entry) error { query := ` UPDATE entries SET title=$1, url=$2, comments_url=$3, content=$4, author=$5, - document_vectors=to_tsvector($1 || ' ' || coalesce($4, '')) + document_vectors=to_tsvector(substring($1 || ' ' || coalesce($4, '') for 1000000)) WHERE user_id=$6 AND feed_id=$7 AND hash=$8 RETURNING id ` |