Flutter、FireBaseを使用した複合クエリの指定方法について

解決したいこと

FlutterおよびFireBaseを使用し、掲示板アプリを作成していいます。
掲載終了時刻が現在時刻より過去の掲示板を取得し、
検索画面より入力した、キーワードをFireBaseにて掲示板名を前方一致で検索が行いたいのですが、
希望のデータが取得できません。
エラーは発生しておりませんが、下記の通り記述した場合、取得結果が0件となります。

なおFireBaseで複合クエリのインデックス登録は完了しておりますが、
FireBaseでは、where()メソッドとstartAt()メソッド、endAt()メソッドは併用できないのでしょうか?

検索処理

dart

1FirebaseFirestore.instance 2 .collection('boards')3 .orderBy('closeTime', descending: true)4 .where('closeTime', isGreaterThan: now)5 .orderBy('title')6 .startAt([title]).endAt(['$title\uf8ff'])7 .snapshots();

単一クエリで確認した際

・終了時刻で絞り込み

dart

1FirebaseFirestore.instance 2 .collection('boards')3 .orderBy('closeTime', descending: true)4 .where('closeTime', isGreaterThan: now)5 .snapshots();

・タイトル(前方一致)で絞り込み

dart

1FirebaseFirestore.instance 2 .collection('boards')3 .orderBy('title')4 .startAt([title]).endAt(['$title\uf8ff'])5 .snapshots();

コメントを投稿

0 コメント