Ask Your Question
0

tag vs. tagname in database

asked 2012-01-05 22:28:01 -0500

A little girl gravatar image

updated 2012-01-05 22:29:07 -0500

Hi,

I am new to Askbot. I have already has the data file for question. I want to import these things into my askbot forum. I import directly through mysql shell from the text file (.csv) to "question" table. In this table, I noticed that a field name "tagnames". Hence I don't know what is the meaning of field tagnames in question table. But this field is a "NOT NULL" field. Could you please explain why we should have "tagnames" field? I also have to import all the "tag" table and "question_tags" table to do a search using tag.

I have also done the following experiment.


I have 3 questions in my database.

Question 1. tagnames="physics", tag="test""image". //import from file -> directly go to database then use admin UI to add tag

Question 2. tagnames="physics", tag="test""image". //import from file

Question 3. tagnames="test" "image", tag="test""image". //submit through UI

As I expect, when I click on "test" tag (question 3), it show up all the 3 questions. However, when start over, click on the tag "physics" of either question 1 or 2, it show nothing (no matched tag). (I expected when click on physics, it show up question 1 and 2).


Then, what is happened behind the scene of clicking the tag?

Thank

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2012-01-06 08:36:32 -0500

Evgeny gravatar image

Hello, if you are creating an importer script, it will be best if you use python calls like user.post_question(), that way all that will be taken care of automatically.

The tagnames field in the question table is a so called denormalized data - simply a copy of tag names associated with the question tags - directly in the question table. That way data loads faster - bypassing the relations to the tag records.

The question_tag table is a bridge table storing assignments of tags to questions and the tag table stores information about tags themselves.

edit flag offensive delete link more

Comments

Could you please explain more about the user.post_question(), i.e how can I use this to import a file with 40 questions record in a file? Or I only can use it to import 1 question at a time, and repeat 40 times? Thanks.

A little girl gravatar imageA little girl ( 2012-01-07 20:35:07 -0500 )edit

How much content are you trying to import? Anyway, for importing I would create a script that first creates users, then with those users posts questions, then answers and comments. If you have the votes - do that after importing all the posts. I would create a script that would load your source file and then process it record by record.

Evgeny gravatar imageEvgeny ( 2012-01-07 21:14:18 -0500 )edit

I have about 1000 questions in 30 files. And I need to add more question later (more excel sheets are on the way). Hence, it is quite a large data. Now, the only way I know is importing through mysql shell the question table, askbot_postrevision, question_tags. Thanks for you quick reply :)

A little girl gravatar imageA little girl ( 2012-01-08 03:17:17 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-01-05 22:28:01 -0500

Seen: 93 times

Last updated: Jan 06 '12