15106: Changes full text search to use trigram indexing
[arvados-workbench2.git] / src / services / api / filter-builder.ts
index 4b3db9fa2b92bb976a577a7e0eb2ee8de4161ab5..77fcef6fca096bf8a13a406f1b3e0b1bd1a8ed25 100644 (file)
@@ -55,6 +55,16 @@ export class FilterBuilder {
         return this.addCondition("properties", "exists", value, "", "", resourcePrefix);
     }
 
+    public addFullTextSearch(value: string) {
+        const terms = value.trim().split(/(\s+)/);
+        terms.forEach(term => {
+            if (term !== " ") {
+                this.addCondition("any", "ilike", term, "%", "%");
+            }
+        });
+        return this;
+    }
+
     public getFilters() {
         return this.filters;
     }