2

My autocomplete services for firebase using angularfire2 v5 look like this:

getUsersTypeAhead(searchString: string) {
    const list: AngularFireList<User> = this.fireBase.list('/users', ref => ref
        .orderByChild('name')
        .limitToFirst(10)
        .startAt(searchString)
        .endAt(searchString + '\uf8ff')
    );
    return list.snapshotChanges().pipe(
        map(items => items.map(item => ({
            key: item.key,
            name: item.payload.val().name
        })))
    );
}

However this appears to be case sensitive. Is this a limitation or is there a query that would be similar to WHERE LIKE in mySQL?

Sandra Willford
  • 3,459
  • 11
  • 49
  • 96

1 Answers1

0

Looking at this answer here Making a firebase query search NOT case sensitive

getUsersTypeAhead(searchString: string) {
    const list: AngularFireList<User> = this.fireBase.list('/users', ref => ref
        .orderByChild('name')
        .limitToFirst(5)
        .startAt(searchString.toUpperCase())
        .endAt(searchString.toLowerCase() + '\uf8ff')
    );
    return list.snapshotChanges().pipe(
        map(items => items.map(item => ({
            key: item.key,
            name: item.payload.val().name
        })))
    );
}
Sandra Willford
  • 3,459
  • 11
  • 49
  • 96