Skip to content
Snippets Groups Projects
Verified Commit 691a9a6b authored by Latte macchiato's avatar Latte macchiato
Browse files

Rename tsvector to sqlTsvector

parents e6464906 b5208c2a
No related branches found
No related tags found
2 merge requests!9272025.2.2,!910TSVector based search provider
......@@ -222,7 +222,7 @@ fulltextSearch:
# You need to install pgroonga and configure it as a PostgreSQL extension.
# In addition to the above, you need to create a pgroonga index on the text column of the note table.
# see: https://pgroonga.github.io/tutorial/
# - tsvector
# - sqlTsvector
# Use Postgres tsvectors.
# You need to create a generated column and index on the note table to use this, followed by an ANALYZE on the table. Beware, this will take a while to be created and the database will remain locked during this process.
# This also enables advanced search syntax, see documentation of websearch_to_tsquery: https://www.postgresql.org/docs/current/textsearch-controls.html#TEXTSEARCH-PARSING-QUERIES
......
......@@ -254,7 +254,7 @@ export type Config = {
};
};
export type FulltextSearchProvider = 'sqlLike' | 'sqlPgroonga' | 'meilisearch' | 'tsvector';
export type FulltextSearchProvider = 'sqlLike' | 'sqlPgroonga' | 'meilisearch' | 'sqlTsvector';
const _filename = fileURLToPath(import.meta.url);
const _dirname = dirname(_filename);
......
......@@ -241,7 +241,7 @@ export class SearchService {
switch (this.provider) {
case 'sqlLike':
case 'sqlPgroonga':
case 'tsvector': {
case 'sqlTsvector': {
// ほとんど内容に差がないのでsqlLikeとsqlPgroongaを同じ処理にしている.
// 今後の拡張で差が出る用であれば関数を分ける.
return this.searchNoteByLike(q, me, opts, pagination);
......@@ -281,7 +281,7 @@ export class SearchService {
if (this.config.fulltextSearch?.provider === 'sqlPgroonga') {
query.andWhere('note.text &@~ :q', {q});
} else if (this.config.fulltextSearch?.provider === "tsvector") {
} else if (this.config.fulltextSearch?.provider === "sqlTsvector") {
query.andWhere('note.tsvector_embedding @@ websearch_to_tsquery(:q)', { q });
} else {
query.andWhere('note.text ILIKE :q', { q: `%${ sqlLikeEscape(q) }%` });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment