- let sth =
- dbh#prepare_cached
- ("select id, url, url_deleted, title, last_modified_date,
- (lower (title) = lower (?)) as exact
- from pages
- where hostid = ? " ^
- (if not old_versions then "and url is not null " else "") ^ "
- and redirect is null
- and title_description_fti @@ to_tsquery (?, ?)
- order by exact desc, last_modified_date desc, title") in
- sth#execute [Some query;
- Some hostid; Some "default"; Some tsquery];
+ let rows =
+ if not old_versions then
+ PGSQL(dbh)
+ "select id, url, url_deleted, title, last_modified_date,
+ (lower (title) = lower ($query)) as exact
+ from pages
+ where hostid = $hostid
+ and url is not null
+ and redirect is null
+ and title_description_fti @@ to_tsquery ('default', $tsquery)
+ order by exact desc, last_modified_date desc, title"
+ else
+ PGSQL(dbh)
+ "select id, url, url_deleted, title, last_modified_date,
+ (lower (title) = lower ($query)) as exact
+ from pages
+ where hostid = $hostid
+ and redirect is null
+ and title_description_fti @@ to_tsquery ('default', $tsquery)
+ order by exact desc, last_modified_date desc, title" in