解决方案
您的查询是正常的,从j,jo,joh,john等开始... startAt方法用指定的起始点创建查询。因此,它看起来如何searchString变量开始。
目前在Firebse中没有全文搜索机制。您可以在网上找到实现这种机制的几种可能性,例如:
firebase.googleblog/2014/01/queries-part-2-advanced-searches-with.html a>
http://firebase.github。 io /手电筒/
I am trying to search the user on the basis of name . It search perfectly if the name is given from first name but didn't search on the string the second name. Where first and second both are saved in one value separated by space for example "John Smith". If search on "john" or "jo" etc it retrieve the record but if its smith it retrieve nothing. Code
var ref = firebase.database().ref().child('User').orderByChild("name").startAt(searchString).endAt(searchString + "\uf8ff"); $scope.usercollection = $firebaseArray(ref);解决方案
With your query it is normal that you only get results starting with j, jo, joh, john, etc... The startAt method "creates a Query with the specified starting point". So it looks at how your searchString variable starts.
There is no full text search mechanism in Firebse for the moment. You will find on the web several possibilities to implement such a mechanism, e.g.:
firebase.googleblog/2014/01/queries-part-2-advanced-searches-with.html
firebase.github.io/flashlight/
更多推荐
Firebase“like”搜索字符串
发布评论