Skip to content

Commit c559129

Browse files
committed
Fix db issue
1 parent 8f4e52b commit c559129

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/app.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export class AppService {
113113
// title match
114114
const conditions = eips.length ? `${eipCondition} AND` : ``;
115115
const titleRecords = await this.connection.query(
116-
`SELECT eip, type, category, ts_headline('english',title, q), rank FROM (SELECT eip, type, category, title, q, ts_rank(title_ts, q) AS rank FROM "EIPs", phraseto_tsquery('english','${txt}') q WHERE ${conditions} title_ts @@ q ORDER BY rank DESC LIMIT 20) AS foo;`,
116+
`SELECT eip, type, category, ts_headline('english',title, q), rank FROM (SELECT eip, type, category, title, q, ts_rank_cd(to_tsvector(title_ts), q) AS rank FROM "EIPs", phraseto_tsquery('english','${txt}') q WHERE ${conditions} title_ts @@ q ORDER BY rank DESC LIMIT 20) AS foo;`,
117117
);
118118

119119
if (titleRecords && titleRecords.length > 0) {
@@ -122,7 +122,7 @@ export class AppService {
122122

123123
// author match
124124
const authorRecords = await this.connection.query(
125-
`SELECT eip, type, category, ts_headline('english', author, q), rank FROM (SELECT eip, type, category, author, q, ts_rank(author_ts, q) AS rank FROM "EIPs", phraseto_tsquery('english','${txt}') q WHERE ${conditions} author_ts @@ q ORDER BY rank DESC LIMIT 20) AS foo;`,
125+
`SELECT eip, type, category, ts_headline('english', author, q), rank FROM (SELECT eip, type, category, author, q, ts_rank_cd(to_tsvector(author_ts), q) AS rank FROM "EIPs", phraseto_tsquery('english','${txt}') q WHERE ${conditions} author_ts @@ q ORDER BY rank DESC LIMIT 20) AS foo;`,
126126
);
127127

128128
if (authorRecords && authorRecords.length > 0) {
@@ -131,7 +131,7 @@ export class AppService {
131131

132132
// content match
133133
const contentRecords = await this.connection.query(
134-
`SELECT eip, type, category, title, ts_headline('english',content, q), rank FROM (SELECT eip, type, category, title, content, q, ts_rank(content_ts, q) AS rank FROM "EIPs", phraseto_tsquery('english','${txt}') q WHERE ${conditions} content_ts @@ q ORDER BY rank DESC LIMIT 20) AS foo;`,
134+
`SELECT eip, type, category, title, ts_headline('english',content, q), rank FROM (SELECT eip, type, category, title, content, q, ts_rank_cd(to_tsvector((content_ts), q) AS rank FROM "EIPs", phraseto_tsquery('english','${txt}') q WHERE ${conditions} content_ts @@ q ORDER BY rank DESC LIMIT 20) AS foo;`,
135135
);
136136
if (contentRecords && contentRecords.length > 0) {
137137
result['content_list'] = contentRecords;

0 commit comments

Comments
 (0)