export class FilterBuilder {
constructor(private filters = "") { }
- public addEqual(field: string, value?: string | boolean | null, resourcePrefix?: string) {
+ public addEqual(field: string, value?: string | string[] | boolean | null, resourcePrefix?: string) {
return this.addCondition(field, "=", value, "", "", resourcePrefix);
}
}
public addFullTextSearch(value: string) {
- const terms = value.trim().split(/(\s+)/);
+ const regex = /"[^"]*"/;
+ const matches: any[] = [];
+
+ let match = value.match(regex);
+
+ while (match) {
+ value = value.replace(match[0], "");
+ matches.push(match[0].replace(/"/g, ''));
+ match = value.match(regex);
+ }
+
+ const terms = value.trim().split(/(\s+)/).concat(matches);
terms.forEach(term => {
if (term !== " ") {
this.addCondition("any", "ilike", term, "%", "%");