.getFilters())
.toEqual(`["myPrefix.etag","in",["etagValue1","etagValue2"]]`);
});
+
+ it('should add full text search', () => {
+ expect(
+ new FilterBuilder()
+ .addFullTextSearch('my custom search')
+ .getFilters()
+ ).toEqual(`["any","@@","my:*&custom:*&search"]`);
+ });
});
return this.addCondition("properties", "exists", value, "", "", resourcePrefix);
}
+ public addFullTextSearch(value: string) {
+ // Filter construction implementation taken from
+ // https://dev.arvados.org/projects/arvados/repository/entry/apps/workbench/app/assets/javascripts/filterable.js
+ // https://dev.arvados.org/projects/arvados/repository/entry/apps/workbench/app/assets/javascripts/to_tsquery.js
+ return this.addCondition('any', '@@', value.replace(/[^-\w\.\/]+/g, ' ').trim().replace(/ /g, ':*&'));
+ }
+
public getFilters() {
return this.filters;
}