custom search implementation
I am new to web designing .. I am designing a video streaming website something like youtube. I have many videos and their details(in a separate xml fi开发者_运维问答le, which has fields like speaker, title etc.) I want to implement a custom search on the basis of their fields and i dont know how to. please help me out. should i combine them to a mysql table or parse through multiple xml files, if so how to? p.s there are a lot of videos. (i don't want to use a google search or something like that .. i want to implement one)
Thanks a lot.
I'd split all search terms (in descriptions, titles etc) up into their separate words, and then store those in a database. Easy to index, and easy / fast to query. I'd probably use mongodb instead of mysql, but that's mainly a matter of taste. Which one that will be best performance-wise for this task would have to be profiled.
If you want to, you can also, for each term, store what kind of search criteria it is (tag, title, description etc) so that you can do more advanced searches if you want to.
You may want to have a look at some Lucene based search engine.
Since you're using PHP you probably want to have a look at Zend_Search_Lucene.
Alternatively have a look at Apache Solr which is a standalone search engine with great capabilities and API.
精彩评论