1

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?

Diego Portillo
  • 103
  • 1
  • 7

1 Answers1

0

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.

Diego Portillo
  • 103
  • 1
  • 7
  • Not sure about the best way of doing a SQLite to Postgres migration… ideally it would be something that just copies the data over after you’ve run migrate on the new database. Django’s dumpdata/loaddata commands might do it, but you’ll need to take care to get the command-line options right - maybe someone’s written that up in a blog post somewhere. – Diego Portillo Sep 23 '22 at 16:02