Files
mgdigital 6358b27bc6 Search query string rework (#96)
- `search_string` field is removed
- text search vector for `content` and `torrent_contents` is generated in code with improvements in normalisation and tokenisation
- the slow `LIKE` query is removed from text search
- a query DSL is implemented which translates the input search string to a Postgres tsquery
- a CLI command (`reindex`) is provided for updating the tsv for pre-existing records
- the unused `tsv` and `search_string` fields are removed from the `torrents` table

See https://github.com/bitmagnet-io/bitmagnet/issues/89
2024-01-07 11:51:40 +00:00

43 lines
2.1 KiB
Go

// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package model
import (
"time"
"github.com/bitmagnet-io/bitmagnet/internal/database/fts"
)
const TableNameContent = "content"
// Content mapped from table <content>
type Content struct {
Type ContentType `gorm:"column:type;primaryKey;<-:create" json:"type"`
Source string `gorm:"column:source;primaryKey;<-:create" json:"source"`
ID string `gorm:"column:id;primaryKey;<-:create" json:"id"`
Title string `gorm:"column:title;not null" json:"title"`
ReleaseDate Date `gorm:"column:release_date" json:"releaseDate"`
ReleaseYear Year `gorm:"column:release_year" json:"releaseYear"`
Adult NullBool `gorm:"column:adult" json:"adult"`
OriginalLanguage NullLanguage `gorm:"column:original_language" json:"originalLanguage"`
OriginalTitle NullString `gorm:"column:original_title" json:"originalTitle"`
Overview NullString `gorm:"column:overview" json:"overview"`
Runtime NullUint16 `gorm:"column:runtime" json:"runtime"`
Popularity NullFloat32 `gorm:"column:popularity" json:"popularity"`
VoteAverage NullFloat32 `gorm:"column:vote_average" json:"voteAverage"`
VoteCount NullUint `gorm:"column:vote_count" json:"voteCount"`
CreatedAt time.Time `gorm:"column:created_at;not null;<-:create" json:"createdAt"`
UpdatedAt time.Time `gorm:"column:updated_at;not null" json:"updatedAt"`
Tsv fts.Tsvector `gorm:"column:tsv" json:"tsv"`
Collections []ContentCollection `gorm:"many2many:content_collections_content" json:"collections"`
Attributes []ContentAttribute `json:"attributes"`
MetadataSource MetadataSource `gorm:"foreignKey:Source" json:"metadata_source"`
}
// TableName Content's table name
func (*Content) TableName() string {
return TableNameContent
}