Diego Portillo
Diego Portillo

Reputation: 303

Wagtail 4.0.1 Admin/Search not working with Postgres PostgreSQL 12.12 Database

I have this issue related to the pages search, on the admin side of wagtail. This is the Django Error:

ProgrammingError at /admin/pages/search/

function ts_rank(unknown, text, tsquery) does not exist
LINE 1: ...ry"."body") @@ (to_tsquery('''irp''')) ORDER BY ((ts_rank('{...
                                                             ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

When i debug the wagtail code, the pages query result returns this:

Unable to get repr for <class 'wagtail.search.backends.database.postgres.postgres.PostgresSearchResults'>

After looking at wagtail 4 documentation, there's no info about the postgres search engine. Only in documentation up to 2.15 version. And this:

WAGTAILSEARCH_BACKENDS = {
"default": {
    "BACKEND": "wagtail.search.backends.database",
}

}

...should work with Postrgres from then on.

The data base was originally in SQLite and then i migrated to Postgres with pgloader

Is there any configuration/upgrade I missed to make wagtails admin search work with postgres? Can the problem be an error caused by the migration?

Upvotes: 1

Views: 290

Answers (1)

Diego Portillo
Diego Portillo

Reputation: 303

After talking with Wagtail Support via Slack they've told me that the error is caused by the pgloader migration. Since it was a small project on-develpoment project i decided to rerun the migrations in a new database but it's not the best solution if you have lots of data already.

Upvotes: 0

Related Questions