I am working on project where users are registered with properties like age, skincolor, languages, height etc in SQL.
I want to provide search feature on registered users accepting range values. Example Search users between age between 15 to 20, who can speak English and French and skin color is Black. Also this request has to be stored in SQL.
One way to do this will be: Provide request object which is constructed based on attribute being searched. Like
searchUsersRequest : {
"age" : {
"min" : 15
"max" : 20
},
"languages" : [
"English",
"French"
],
"skinColor" : [
"Brown",
"Black"
],
.
.
.
.
}
After reading the request, create query and run on db.
Here are two questions:
-
Is there any better way/ generic approach to solve this problem?
-
How should I stored this request object in DB? Should I just stored it as just one string or any other better way?
Thanks in advance for your suggestions!
Aucun commentaire:
Enregistrer un commentaire