lundi 15 décembre 2014

Should I store multiple data in a single wp_post field


I hope this is the right place to ask this question. I have chosen to work in a Wordpress environment so this should apply here.


I have to design an application that will store hundreds of thousands of questions. The questions will be searchable. Wordpress has all the functions that I require so I want to start off that. I have to choose the best way to store the questions for the application. The questions will also be used by other applications sent via xml.


Each question in the database will have answers attached to it. Each question may have more that two answers. Each answer will have explanations attached to it. This will hold different ways of explaining the answer. Each answer will have hints stored separately as hint1, hint2, etc. And each answer will contain a list of acceptable formats. A single question may also contan sub questions usually 3 to four questions and each sub question will have the attachments described above i.e; answers, explanations, hints, etc.


Here is an overview of a typical question structure.



Question
Question
Sub questions
Question
Answers
etc...
Answers
Answer1
Explanations
Explanation1
Explanation2
acceptable-formats
format1
format2
Answer-hints
hint1
hint2
Answer2
Explanations
Explanation1
Explanation2
acceptable-formats
format1
format2
Answer-hints
hint1
hint2


Each question may have other settings/attributes/meta such as how it is displayed. So if I am expecting to store hundreds of thousands of questions the original instinct was to use PHP objects. I create an object in php and store it in a single field as a Wordpress post. There are many benefits to using this especially when designing an API to access the questions which will have to be delivered in XML.


If I dare create a post type for each question object/feature surely this is going to aggravate the MySQL table. I could treat small texts like hints, formats as postmeta. Should I just use the two MySQL tables; wp_posts and wp_postmeta?





Aucun commentaire:

Enregistrer un commentaire