dimanche 5 février 2017

flexible assistant filter/orderBy for mysql table

I store the data into mysql and the schema is like

id (primary key)
data_id (long)
insert_time (date)

When client read data, the sever will get the dataIds first and then fetch some other data from other services and return to client with filled dataObject just like

long id, long dataId, String type, int score, String info,...

But sometimes I need filter dataIds by type or sort dataIds by score and because the returned data might be pageable, so I cannot filter or sort data in the service and dataIds should be filtered or sorted before filling dataObject. Of course, I can add the type/score into the MySQL table and set the related value when saving dataId. But it might be not flexible for the filterBy or sortBy column might be changed.

I want to find some assistant services which help to filter or sort dataIds. And when saving dataIds into MySQL, I will fetch type/score... first and then insert the relationship into the assistant service. And when the client need filtered/sorted dataIds, I can query from this assistant service. As far as I know Solr might help to do this and I want to know if there are some other services or solutions?

Aucun commentaire:

Enregistrer un commentaire