Browse Source

add missing text index for tasks

Aneurin Barker Snook 1 year ago
parent
commit
f589f0cac7
1 changed files with 5 additions and 0 deletions
  1. 5 0
      src/task/model.ts

+ 5 - 0
src/task/model.ts

@@ -24,6 +24,11 @@ async function createTaskModel(ctx: Context) {
   /** Initialize the task collection. */
   async function init() {
     await ctx.db.createCollection('task')
+
+    const exists = await collection.indexExists('task_text')
+    if (!exists) {
+      await collection.createIndex({ description: 'text' }, { name: 'task_text' })
+    }
   }
 
   /**