Firebase: If a value includes a specific text in database [duplicate] - firebase

This question already has answers here:
How to perform sql "LIKE" operation on firebase?
(5 answers)
Closed 3 years ago.
I try to filter the list for items that contain a certain text.
database:
{"123":{"cities":"sss"},"445":{"cities":"hello hi dd"}}
And I want to get the items that contains "hi" within the cities value:
{"445":{"cities":"hello hi dd"}}
I tryd this:
https://xxxxx.firebaseio.com/allitems.json?orderBy="cities"&startAt="hi"
But it's not working... It only shows the items that starts with "hi"...
thanks.

At the time of writing, there is no built-in full-text search capability in the Firebase Realtime Database.
The official Cloud Functions samples include an example of full-text search with the Algolia hosted search service.
Note that there is a workaround if you search for a string that starts with some specific characters (which is different than a string which contains some specific characters).
Have a look at the "Range Queries" section of the REST API documentation:
We can combine startAt and endAt to limit both ends of our query. The
following example finds all dinosaurs whose name starts with the
letter "b":
curl
'https://dinosaur-facts.firebaseio.com/dinosaurs.json?orderBy="$key"&startAt="b"&endAt="b\uf8ff"&print=pretty'
The \uf8ff character used in the query above is a very high code point
in the Unicode range. Because it is after most regular characters in
Unicode, the query matches all values that start with a b.
So in your case you would do as follows:
https://xxxxx.firebaseio.com/allitems.json?orderBy="cities"&startAt="hi"&endAt="hi\uf8ff"

Related

using multi choice and collection in blueprism

I have about 3 collections and i want to write into an excel and send them in mail separately, I tried to use multi choice to finalize one after the other but it doesn't work
any other idea how to do this?
I will put screen shots below for more illustration
It's likely not functioning the way you intended because each of the three Data Items you're attempting to compare to a blank string ("") aren't Text-typed - rather, they're Collections. Collections themselves can't be compared to strings (see: apples and oranges), but the data contained within them can.
What you're likely attempting to do is to compare the value within the current row of each of those collections - it's not clear what the field name is from your screenshot (the field name itself is cut off on the right edge) but your comparisons should look something like the following:
[No Amount.Politic]<>""
[Pending difference.Field]<>""
[Ready to print.Field]<>""

Compare two Firestore Timestamps by "greater than" [duplicate]

This question already has an answer here:
Filter including field in formula
(1 answer)
Closed 3 years ago.
I'm trying to compare two timestamps inside a cloud function.
Not by "equality" (as described here) but by "greater than".
I do not know where is the problem, but I can't get it working.
This is my code, quite simple:
const lastDayUnread = await admin.firestore()
.collection('/unread')
.where('last_message', '>', 'last_seen')
.get()
I also tried using .seconds property but still nothing:
.where('last_message.seconds', '>', 'last_seen.seconds')
If I execute the same query from a JS client, it works, and teh console shows me that there is a Timestamp object inside my documents last_seen and last_message properties.
The right-hand side of a where clause in Cloud Firestore must be a literal value. There is no support for looking up the value of another field.
The typical workaround would be to store an additional field with last_message.seconds - last_seen.seconds and then:
.where('delta_seconds', '>', 0)

Google Analytics API - filter dimension sourceMedium

I would like to filter certain sources and mediums (specifically email clients). I need to keep the dimension as one column (I use the maximum number of dimensions - 7).
The filter works fine when I have only one sourceMedium such as:
ga:sourceMedium!=amail.centrum.cz / referral
Filter doesn’t work at all when I use two sourceMedium:
ga:sourceMedium!=amail.centrum.cz / referral,ga:sourceMedium!=mail.google.com / referral
It doesn’t matter If I use AND / OR, the query doesn’t output the desired data.
I assume that there supposed to be some delimiter which could identify that amail.centrum.cz is one string which is delimited by another one. I already tried to use ' at the beginning and at the end of the string, but it seems that it doesn’t work.
Is there anything that I missed in docs or anything else? Looking for your help :)
BTW: I'm aware of the solution: Pull out data from GA, filter data manually (compare output data vs my list of email clients what I would like to exclude)

Firebase "like" search on string [duplicate]

This question already has answers here:
How to perform sql "LIKE" operation on firebase?
(5 answers)
Closed 5 years ago.
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.:
https://firebase.googleblog.com/2014/01/queries-part-2-advanced-searches-with.html
https://github.com/FirebaseExtended/flashlight

Comma Separated check in asp.net

How to search every word separated by comma in textbox
Please refer above post
Its Working perfectly...But i have small issues.. when i enter in text box like c,c++,4-5 yrs it have to check in database like either c,c++ skills and 4-5 yrs experiecne and then the reult has to be shown... Burt as per ur query it just show results whether any one of keyword satisfy database ...I want to compare year also how? –
If you want that behavior, you have to program that behavior. One design is to have multiple input boxes: one where you check if any of the words exist, another where you check that all of the words exist. (Perhaps even another for an exact phrase match.) Another design possibility would be for you to develop a syntax to indicate optional and required words all within a single input box. The point is it is up to you.
After you've decided on a design, then you could write code that builds your query based on or matches on the optional words and and matches on the required. Something like this pseudocode
Select * From Table Where
(Field Like OptionalWord1 Or Field Like OptionalWord2 Or Field Like OptionalWord3)
And Field Like RequiredWord1
And Field Like RequiredWord2
(etc.)

Resources