[PATCH] pgweb: Search: bugfix: replace sites.baseurl with sites.hostname

From: Célestin Matte <celestin(dot)matte(at)cmatte(dot)me>
To: PostgreSQL WWW <pgsql-www(at)lists(dot)postgresql(dot)org>
Subject: [PATCH] pgweb: Search: bugfix: replace sites.baseurl with sites.hostname
Date: 2021-10-22 14:59:17
Message-ID: 21fbb020-83c6-33e5-9cfe-0aee56badf3e@cmatte.me
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-www

Hello,

There is an issue in the sql files for search in pgweb, as schema.sql does not correspond to what is used in functions.sql.
functions.sql uses sites.baseurl, which is not a field in schema.sql. I replaced it with sites.hostname, which I guess is the targeted field.

Without that patch, I get the following error when performing a search:

Traceback (most recent call last):
File "/srv/pgweb/local/pgweb/search/views.py", line 284, in search
'internal': include_internal,
psycopg2.errors.UndefinedColumn: column sites.baseurl does not exist
LINE 1: SELECT sites.id AS siteid, sites.baseurl, webpages.suburl, t...
^
QUERY: SELECT sites.id AS siteid, sites.baseurl, webpages.suburl, ts_rank_cd(fti,tsq) * relprio AS ts_rank_cd FROM web
pages INNER JOIN sites ON webpages.site=sites.id WHERE fti @@ tsq AND site=1 AND (includeinternal OR NOT isinternal) OR
DER BY ts_rank_cd(fti,tsq) * relprio DESC LIMIT 1000
CONTEXT: PL/pgSQL function site_search(text,integer,integer,text,boolean) line 21 at OPEN

Cheers,
--
Célestin Matte

Attachment Content-Type Size
0001-Search-bugfix-replace-sites.baseurl-with-sites.hostn.patch text/x-patch 2.0 KB

Responses

Browse pgsql-www by date

  From Date Subject
Next Message Célestin Matte 2021-10-22 15:08:19 [PATCH] pgweb: Add SEARCH_DSN to example settings.py
Previous Message Célestin Matte 2021-10-18 16:19:25 [PATCH] pgarchives: Fix database install procedure: remove redundant tables in schema.sql