aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/utils.ts')
-rw-r--r--server/models/utils.ts14
1 files changed, 1 insertions, 13 deletions
diff --git a/server/models/utils.ts b/server/models/utils.ts
index 99e146583..58a18c97a 100644
--- a/server/models/utils.ts
+++ b/server/models/utils.ts
@@ -51,17 +51,6 @@ function createSimilarityAttribute (col: string, value: string) {
51 ) 51 )
52} 52}
53 53
54function createSearchTrigramQuery (col: string, value: string) {
55 return {
56 [ Sequelize.Op.or ]: [
57 // FIXME: use word_similarity instead of just similarity?
58 Sequelize.where(searchTrigramNormalizeCol(col), ' % ', searchTrigramNormalizeValue(value)),
59
60 Sequelize.where(searchTrigramNormalizeCol(col), ' LIKE ', searchTrigramNormalizeValue(`%${value}%`))
61 ]
62 }
63}
64
65// --------------------------------------------------------------------------- 54// ---------------------------------------------------------------------------
66 55
67export { 56export {
@@ -69,8 +58,7 @@ export {
69 getSortOnModel, 58 getSortOnModel,
70 createSimilarityAttribute, 59 createSimilarityAttribute,
71 throwIfNotValid, 60 throwIfNotValid,
72 buildTrigramSearchIndex, 61 buildTrigramSearchIndex
73 createSearchTrigramQuery
74} 62}
75 63
76// --------------------------------------------------------------------------- 64// ---------------------------------------------------------------------------