set default search operator for acqlia fields to "contains"
authorGalen Charlton <gmc@equinoxinitiative.org>
Thu, 23 Jan 2020 15:24:44 +0000 (10:24 -0500)
committerGalen Charlton <gmc@equinoxinitiative.org>
Thu, 23 Jan 2020 15:24:44 +0000 (10:24 -0500)
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/eg2/src/app/staff/acq/search/acq-search-form.component.ts

index cc7d08e..5125c06 100644 (file)
@@ -113,6 +113,14 @@ export class AcqSearchFormComponent implements OnInit, AfterViewInit {
         term.value1 = '';
         term.value2 = '';
         term.is_date = false;
+
+        if (term.field.startsWith('acqlia:') && term.op === '') {
+            // default operator for line item attributes should be "contains"
+            term.op = '__fuzzy';
+        } else if (this.searchTermDatatypes[term.field] !== 'text' && term.op.endsWith('__fuzzy')) {
+            // avoid trying to use the "contains" operator for non-text fields
+            term.op = '';
+        }
     }
     // conditionally clear the search term after changing
     // to selected search operators