manually adding terms to nodes directly from db I have lots of nodes in my system. I want to add them some taxonomy terms.

I have a CSV file for each term, and in this file I have the list of node id's. Example:

apples.csv:

5
9
12
24
....
....

SO I need node 5, 9, 12 and 24 to have the term "apples".

I wrote a php script to directly add that term to each of the nodes. That script populates the table "field_data_field_category" correctly.

I can also see the term on the node page.

The problem is the nodes dont appear in the term page. Also if I create a view to display nodes of specific term, it becomes empty.

Is there another table to keep the node - term relationship?

EDIT: 

I just found that there is another table keeping the relationship between node and term: taxonomy_index: "Maintains denormalized information about node/term..."

How does this table populated? On a cron run? Because I see some of my node - term pairs there. Some not.
You may use the Feeds module to update all your nodes with new terms.