Firebase高级词典搜索 [英] Firebase Advanced Dictionary Search

查看:164
本文介绍了Firebase高级词典搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Firebase中有许多电报键盘,而且我希望有一个高级字典搜索键盘的孩子,等级深,用户输入,

Forexample用户输入 rock ,我想让每个键盘包含在开始 end end ,在这个例子中我有3个键盘: morning rock 和 rocky

  const ref = db.ref('Keyboards / rock'); //键盘1 
const ref = db.ref('Keyboards / morning'); //键盘2
const ref = db.ref('Keyboards / rocky'); //键盘3

我怎样才能取得和 console.log rock 时,c $ c>: rock 和 rocky >


我的问题90%由@rymdmaskin解决,但高级字典搜索仍然是打开的。

equalTo startAt endAt 不工作,我需要像包含使用弹性搜索( https:// firebase .googleblog.com / 2014/01 / queries-part-2-advanced-searching-with.html
$ b 结构:

规则:

  {
rules:{
.read:true,
.write:true,
Keyboar ds:{
.indexOn:键盘
}
}
}

代码:

  const ref = db.ref( '/'); ($)$ b $ ref.child('/')。orderByChild('Keyboards')。equalTo('rock')。on(value,function(snapshot){
console.log(snapshot.val ));
key = snapshot.forEach(function(data){
console.log(data.key);
});
});


Google目前做全文搜索的方法似乎是使用Algolia或BigQuery与云端功能同步Firebase。



使用(弹性搜索):
https://medium.com/joolsoftware/extending-firebase-with-cloud-functions-elasticsearch-129fbbb951e0


I have many Telegram Keyboards in my Firebase, and I Want to Have an Advance Dictionery Search for Childs of Keyboards, I Mean in Secend Level Deep, that the user entered,
Forexample user entered rock, I want to get each Keyboards contain rock at the begin or middle or at the end, in This Example I have 3 Keyboards: morning, rock and rocky.

const ref = db.ref('Keyboards/rock');  //keyboard 1
const ref = db.ref('Keyboards/morning');  //keyboard 2
const ref = db.ref('Keyboards/rocky');  //keyboard 3

How Can I get and console.log: rock and rocky when user typed rock?
My Problem 90% Solved By @rymdmaskin But Advance Dictionery Search Still is Open.
equalTo and startAt and endAt Not Work, I need Something like contain, Someone Said to use Elastic Search (https://firebase.googleblog.com/2014/01/queries-part-2-advanced-searches-with.html)

Structure:

Rules:

{
  "rules": {
    ".read": true,
    ".write": true,
      "Keyboards" : {
             ".indexOn": "Keyboards"
         }
  }
}

Code:

const ref = db.ref('/');
  ref.child('/').orderByChild('Keyboards').equalTo('rock').on("value", function(snapshot) {
    console.log(snapshot.val());
    key = snapshot.forEach(function(data) {
        console.log(data.key);
    });
});

解决方案

Google's current method to do full text search seems to be syncing with either Algolia or BigQuery with Cloud Functions for Firebase.

Usage (elastic Search): (https://medium.com/joolsoftware/extending-firebase-with-cloud-functions-elasticsearch-129fbbb951e0)

这篇关于Firebase高级词典搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆