相关疑难解决方法(0)

检查 Firestore 中的任何文档是否包含子字符串

我在 Firestore 中收集了大量具有随机 ID 的文档,每个文档都有两个字段:名称和描述。我希望我的应用程序允许用户输入一系列字符,然后向他展示包含该字符序列(例如名称字段)的所有文档。使用 Firebase 及其查询是否可行?如果可以,您能给我一个 Kotlin 或 Java 代码示例吗?我知道有一些方法,例如hasChild()child("child name").exists(),但由于我还不知道用户正在查找哪个文档,如果我没有弄错的话,我无法使用它们。

例如,如果我有 3 个具有以下名称(“mike”、“michael”、“dave”)的文档的集合,并且用户输入“mi”,我希望能够检索其名称的文档是“迈克”和“迈克尔”。

android firebase google-cloud-firestore

2
推荐指数
1
解决办法
7736
查看次数

是否可以在FirestoreRecyclerOptions中使用Algolia查询?

为了让我的用户执行更复杂的搜索,我正在与Algolia合作。

com.algolia.search.saas.Query algolia_query =
                    new com.algolia.search.saas.Query(mLastQuery)
                    .setAttributesToRetrieve("content")
                    .setAttributesToRetrieve("category")
                    .setHitsPerPage(10);
            index.searchAsync(algolia_query, new CompletionHandler() {
                @Override
                public void requestCompleted(JSONObject jsonObject, AlgoliaException e) {
                    Log.d("algolia", jsonObject.toString());
                }
            });
Run Code Online (Sandbox Code Playgroud)

我想将此jsonObject转换为兼容的东西,FirestoreRecyclerOptions以便能够使用FirestoreRecyclerAdapter

谢谢 !

android google-cloud-firestore

0
推荐指数
1
解决办法
2302
查看次数

标签 统计

android ×2

google-cloud-firestore ×2

firebase ×1