Yes, each tag has unique Id. It is not necessary that I have to store these unique id's in a table. I can store them in this way…
$tags = array("Music","Sports","Food","Books",………)
Array is the best way for me as it is easily alterable. Moreover the array keys itself will serve as the unique Id's.
But my situation is more critical, so let me elaborate the exact situation.
I have a single table with fields like Id, Title, Description, Tags, etc. etc. etc.
Id | Title | Description | Tags
1 | Sport & Hygine| With sport & music good food is …| Sport, Food
2 | Rock Concert | Great Rock Show at … | Music, Dance
If a user selects (filter) to show records, that has Music in the Tags field. Although the Title and description does not have the word Music at all in the second row, but still it should get the first priority. Also it should be noted that Title and Description are text fields and Sphinx should search the normal way giving appropriate Weights and Ranks to Titles and Description. But Tags field cannot be searched as text indexing. Tags field needs to be filtered.
Therefore, in the above example, if Music is selected, then row 2 should only be displayed, because it is filtered based on Tags and Row 2 only has Music in the Tags field. But Music is also present in Row 1 in the Description field, but here it should be ignored. I hope I am able to clarify the situation. Any hep with this is highly appreciated.