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

37 lines
1.1 KiB
Go

package databasefx
import (
"github.com/bitmagnet-io/bitmagnet/internal/boilerplate/config/configfx"
"github.com/bitmagnet-io/bitmagnet/internal/database"
"github.com/bitmagnet-io/bitmagnet/internal/database/cache"
"github.com/bitmagnet-io/bitmagnet/internal/database/dao"
"github.com/bitmagnet-io/bitmagnet/internal/database/healthcheck"
"github.com/bitmagnet-io/bitmagnet/internal/database/migrations"
"github.com/bitmagnet-io/bitmagnet/internal/database/postgres"
"github.com/bitmagnet-io/bitmagnet/internal/database/search"
"github.com/bitmagnet-io/bitmagnet/internal/database/search/warmer"
"go.uber.org/fx"
)
func New() fx.Option {
return fx.Module(
"database",
configfx.NewConfigModule[postgres.Config]("postgres", postgres.NewDefaultConfig()),
configfx.NewConfigModule[cache.Config]("gorm_cache", cache.NewDefaultConfig()),
configfx.NewConfigModule[warmer.Config]("search_warmer", warmer.NewDefaultConfig()),
fx.Provide(
cache.NewInMemoryCacher,
cache.NewPlugin,
dao.New,
database.New,
healthcheck.New,
migrations.New,
postgres.New,
search.New,
),
fx.Decorate(
cache.NewDecorator,
),
)
}