简体   繁体   中英

How to search with space In Flutter Firebase

I Want to Search from by firebase database, But When space in between a name then it does not works at all. So what can i do now.. it works before space is given....

Code:

stream: (searchString==null || searchString.trim()=='')? 
      Firestore.instance.collection('ebook').snapshots() : Firestore.instance.collection('ebook')
          .where('searchIndex',arrayContains: searchString)
          //.where('organization',isEqualTo: searchString )
          .snapshots(),

这是我的 Firebase 数据库

Try adding the following:

.where("searchIndex", isGreaterThanOrEqualTo: searchString)  //String comparison
.where('searchIndex', isLessThan: searchString + 'z') //Shows all results until the letter ends with a Z, so this should include spacebar

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM