首页 > 解决方案 > 在firestore中,如何搜索包含相似文本的字段

问题描述

在firestore数据库中,有一个位置字段,例如:

{
...
"location" : "London, England",
...
}

我想得到这个搜索词:伦敦/伦敦/英格兰/英格兰

到目前为止,我已经尝试过:

              Firestore.instance
              .collectionGroup("posts")
              .orderBy(location)
              .where(location,
                  isGreaterThanOrEqualTo: widget.location)
              .where(location,
                  isLessThanOrEqualTo: widget.location + "z")

如何解决这个问题?

标签: firebasefluttergoogle-cloud-firestore

解决方案


推荐阅读