Firebase Search query [duplicate] - java

This question already has answers here:
It is possible to have a contains search query in firebase? [duplicate]
(2 answers)
Closed 3 years ago.
i want to search from firebase where the name contain that character from search box at any position in the name? any one help me please
just like this
Query firebaseSearchQuery =
myRef.orderByChild("from").contains(searchText);

You cannot perform contains query in firestore, you can only perform equals to query in firestore, if you want to perform contains query you need to integrate with Algolia

Related

How do i set double query of Firebase Realtime Database? [duplicate]

This question already has answers here:
Query based on multiple where clauses in Firebase
(8 answers)
Closed 3 years ago.
From below query I get the data in order of timestamp
Query Users = FirebaseDatabase.getInstance.getReference.child("Users").orderbychild("timestamp");
Now all children are ordered by time.
But how do I filter this query by CurrentUserId?
Query CurrentUser = Users.orderbychild("CurrentUserId");
Firebase does not support multiple orderbychild method. What you can do is, first fetch records from Firebase with current user id
Query Users = FirebaseDatabase.getInstance.getReference.child("Users").orderbychild("CurrentUserId");
Then do timestamp sorting at client end.

Passing variable into IN clause in java [duplicate]

This question already has answers here:
Hibernate Criterion IN Clause 1000 break up
(3 answers)
Java Oracle exception - "maximum number of expressions in a list is 1000"
(7 answers)
Closed 5 years ago.
I am constructing a hibernate query and I pass a list of String values into the IN clause. That list sometimes happens to be more than 1000 values so I receive an error. I have looked up some solutions like breaking that clause into smaller ones or making temporary table, but none of them showed how actually it is better to work with variable list.
So if I had something like:
SELECT * FROM MY_TABLE WHERE NAME IN (list).
What would be the best way to handle this?

Isnumeric in postgreSQL [duplicate]

This question already has answers here:
Postgres query to check a string is a number
(8 answers)
Closed 5 years ago.
I have column in my database table named 'anwers' of type 'character'. Data may be numbers or strings that's why I used column of type 'character'. And I have to calculate the sum of anweres if it is a numeric. But I found that ISNUMERIC will not work for column type of text/character .
How can I solve this issue?
In DB2, I've done something like UCASE(answers) = LCASE(answers) to test if it's numeric. This could work if your column is simple letters/numbers, not including punctuation characters.

How to get data from sqlite in order by text date in android [duplicate]

This question already has answers here:
Sorting dates in sqlite database?
(3 answers)
Closed 6 years ago.
I have stored date in sqlite database as text in this format : '1 Jan 99'.
Now I want to get data from sqlite database in order by date.
Already tried :
SELECT * FROM Table ORDER BY date(dateColumn) DESC
Select * from Table order by datetime(datetimeColumn) DESC
Please Help!!
try the requet SELECT * FROM Table ORDER BY dateColumn

How can I avoid duplicates in my "mysql" database when using hibernate (JAVA)? [duplicate]

This question already has answers here:
Best way to avoid duplicate entry into mysql database
(4 answers)
Closed 7 years ago.
I parse a .lst file to get data, then I use hibernate in order to add these data in a mysql database.
My file is always updated with new data but it KEEPS existing ones.
The question is how can I avoid duplicates data in my database when I parse the file a scond time.
Thanks
INSERT INTO table_name ('your fields') VALUES ('New values') ON DUPLICATE KEY UPDATE field1=' value',field2='value',.....;
Table Structure:
make this 2 fields (name and city )Uniqe
ex:
INSERT INTO tbl_stud(name,city)values('Divyesh','Ahmedabad') ON DUPLICATE KEY UPDATE name='Divyesh',city='Ahmedabad';

Categories

Resources