Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+3 votes
1.2k views
in Q2A Core by
Hello!

I'm starting to look at a deeper integration with Q&A and our existing data. Thanks to the great documentation, user login is perfectly integrated. I was now wondering if you would have any pointer to where to start to use (create/store/view) Categories and Tags from my own DB instead of using Q&A tables? Q&A share the same DB than my main site.

Maybe this could be a new external point, like the emailer and the users.

Thanks!

Mélanie

2 Answers

+1 vote
by
 
Best answer

If you are interested to have that feature, I've sent my modifications and they have been added there:

http://www.question2answer.org/addons.php

With the code in there, you can integrated your categories in the same way than single sign on is integrated. Tags are only used for auto-completion, this seemed enough integration to me. You can be notified when a question is associated to a categories and tags in the proper php file.

+1 vote
by
edited by
Hi Mélanie, and welcome!

I think it would be a pretty major code change to integrate the categories and tags via a single database table, because of all the JOINs that Q2A performs based on its expectation of its tables having a certain form.

However you could certainly have your own code modify Q2A's tables, to add tags and categories and the like. Categories are defined in the qa_categories table. Tags don't have their own table, but are set on a per-post basis and then indexed. So you could programatically add a bunch of posts with the tags you wanted, then click the "Reindex..." button in the "Stats" section of the "Admin" panel to index them.
by
Thanks gidgreen for that quick answer. Actually, tags and categories already exist in my database in their own format (different tables, quite a complex structure in fact). So I would need to kind of "by pass" the way Q&A works with its categories and tags to use them. I was guessing it couldn't be easy.

You may be right, pushing the data TO Q&A will probably be a lot simpler! I just have to make sure everything stays in synch.
by
Just went back to this problem and I just realized that tags from hidden question are not proposed to user. Which post are examined for tags?
by
I'm afraid only the tags of visible questions are used for tag suggestions. This is pretty hard to change since it relates to the database contents in several places. So instead I think this would need to be a core code modifications - look for qa_db_popular_tags_selectspec and you'll see when the list of most popular tags is retrieved. You could retrieve something different instead.
...