I need to write search functionality for a website full of videos. The videos are hosted by a 3rd party online video platform (OVP) like brightcove, kaltura, ooyala etc… The OVP offers a search API. The OVP holds the following information for each video: title, description, is_published, duration, tags and create_date. The search API easily performs search and sorting on these fields.
However, I would like to ascribe more information to each video such as: available close cap langauges, number of views, number of likes, most popular in past month etc… I suppose the best way for me to store this data is in my own database table, with a FK video_id that relates to the video_id in the OVP’s video database table.
If I want to search for videos across fields in both the OVPs video database table via their API and the my own video database table tbl_video_meta_data via SQL statements, how should I do it?
I thought of two solutions, but not sure if either of them are a good idea, or if there are other alternatives to consider
1) Perform a search via the OVP search API based on its supported fields. Then perform a separate search within my own tbl_video_meta_data based on its own available fields. Then display records that are common to both search results. In this approach, I’m worried about the performance of doing two separate searches, and then filtering them again at the coding level instead of using SQL to do all this.
2) I should have a cronjob that periodically fetches video data from the OVP and loads it to a tbl_video_cache. tbl_video_cache is truncated each time this happens. My table tbl_video_meta_data will of course have an FK video_id that relates to tbl_video_cache. Now I can perform a SQL search on both tables via JOIN. Actually, now that I think about it….this seems to be the best approach.
I think I will go with 2, but curious to know if there are any drawbacks to it.
I just went with 2)
2) I should have a cronjob that periodically fetches video data from the OVP and loads it to a tbl_video_cache. tbl_video_cache is truncated each time this happens. My table tbl_video_meta_data will of course have an FK video_id that relates to tbl_video_cache. Now I can perform a SQL search on both tables via JOIN. Actually, now that I think about it….this seems to be the best approach