相关疑难解决方法(0)

Firebase查询 - 查找包含字符串的子项

我在使用Firebase查询时遇到了一些麻烦.我想查询对象,其中对象子值包含某个字符串.到目前为止,我有一些看起来像这样的东西:

Firebase *ref = [[Firebase alloc] initWithUrl:@"https://dinosaur-facts.firebaseio.com/dinosaurs"];
[[[[ref queryOrderedByKey] queryStartingAtValue:@"b"] queryEndingAtValue:@"b~"]
    observeEventType:FEventTypeChildAdded withBlock:^(FDataSnapshot *snapshot) {
    NSLog(@"%@", snapshot.key);
}];
Run Code Online (Sandbox Code Playgroud)

但是这只会给出起始值为"b"的对象.我想要包含字符串"b"的对象.我怎么做?

database iphone objective-c ios firebase

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

搜索 Firestore 查询不在 RecycleView 中显示数据

这是我在 Firestore 中的数据 我想显示这个名称“mouad”

这是我的代码

公共类 SearchActivity 扩展 AppCompatActivity {

    私有RecyclerView mMainList;
    私有 FirebaseFirestore mFirestore;
    私有列表 usersList;
    私有 CustomAdapter 适配器Re;
    编辑文本编辑文本;
    按钮 btnSearch;
    字符串名称;

    @覆盖
    protected void onCreate(Bundle savingInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_search_firebase);

        mFirestore = FirebaseFirestore.getInstance();


        editText = (EditText) findViewById(R.id.search);
        btnSearch = (按钮) findViewById(R.id.btn);

        用户列表 = 新的 ArrayList();
        adapterRe = new CustomAdapter(getApplicationContext(), usersList);

        mMainList = (RecyclerView) findViewById(R.id.recyvle);
      // mMainList.setHasFixedSize(true);
     // mMainList.setLayoutManager(new LinearLayoutManager(this));
     // mMainList.setAdapter(adapterRe);


        btnSearch.setOnClickListener(new View.OnClickListener() {
            @覆盖
            公共无效onClick(查看v){
                搜索用户Firebase();
            }
        });



    }

    私人无效SearchUserFirebase(){
        名称 = editText.getText().toString();
        if(!name.isEmpty()){

            查询 query = …

java android firebase android-recyclerview google-cloud-firestore

5
推荐指数
1
解决办法
932
查看次数

是否可以在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
查看次数