Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
in Q2A Core by

In http://www.question2answer.org/qa/38883/how-to-add-some-tag-words-to-the-tag-words-database, it is provided a recipe to add tag words to database.

Considering the database, it seems that this recipe is only valid for tags composed of one word... Is that correct?

If the tag is composed of more than one word one has to add the words and then the tag composed of these words. For instance, the tag "email-notification" should be added using

insert into

qa_words(word, titlecount, contentcount, tagwordcount, tagcount)

values('email', 0, 0, 1, 0);

values('notification', 0, 0, 1, 0);

values('email-notification', 0, 0, 0, 1);

1) Is that correct? Am I missing something? Do I have to worry about something more?

2) There are also two tables associated with this, but they will be updated only a post actually use these tags, namely qa_tagwords and qa_posttags. Both of them have the purpose of search?

Q2A version: 1.7.0

1 Answer

+2 votes
selected by
Best answer

1) Yes, it is correct. The difference between what you say and my other answer is that in your case email and notification won't be tags on their own but just words in the database. That means you can search for those words while in my other approach you can't, because you wouldn't even add them.

However, although what you suggest is what the core does, it doesn't make much sense when you're pre-generating tags. This is because if you have no posts that match those words that are part of tags then you won't get any results either. So it is as if they wasn't there and, in that case, then there isn't any need to add them.

Also take into account that when you actually link a post to the email-notification tag the words email and notification are both added to the ^words table. So there is no need to add them.

2) ^posttags primary use seems to be fetching related questions, as well as listing recent questions for a given tag. That's why the table has the date of the post denormalized. In the case of ^tagwords, its main purpose is, as you've mentioned, searching.


I am thinking about designing a QA website where the user chooses some fields (in the (maybe some categories - see my other question http://www.question2answer.org/qa/43020/how-to-manage-categories-and-tags-together) with some "popular" tags associated to that. After some time, I can improve these fields choice based on the correlation between some tags that where not included in the initial database and the ones that arise due to the field choice. Does it make sense?