The result of "related articles" is an example of a higher ranking. in this case, an efficient writing method was obtained. Finally, my article system was edited by sky94132003 from 2014-08-2403: 53: 35, want to follow multiple pieces to see if there is any possibility to achieve 4 tables & nbsp; basic introduction content & nbsp; Article master table idlid & nbsp; the result of "related articles" is a case that is more relevant than the previous one.
This post was last edited by sky94132003 at 03:53:35
My article system, I want to follow multiple entries
To see if there is any possibility.
Four basic table descriptions
Content article master table
Id
Lid = the id of the collection, which is saved in the format of (1, 2, 3)
Tags = ID of the related TAG, saved in the format of (1, 2, 3)
Typeid = the Category ID is only one number.
Collection
Lid
Name
Tags
Id
Name
Category
Typeid
Name
Typeid = Category ID.
Tag = tag,
Lid = a collection, but an article can be put into multiple collections, such as PHP + MYSQL + AJAX without refreshing comments
Users may choose PHP collections, MYSQL articles, and AJAX collections.
If the TAG is shared by the entire site, it will not be added if it is repeated.
Therefore, you cannot create a category list for your own articles, so the collection function is displayed.
Because a part of the article already displays other articles in the current collection
Therefore, in the article, the files in the collection should be at the beginning of the article.
So the prepared relationship ranking is
1. TAG-related
2. collection
3. Latest articles of the current category
Why is it divided into three times ???
Because I am afraid of being too tagged, and I have not used the collection function ....
So the last step is the current classified article.
Current article
The TAG is 3, 14.
Lid = 7, 12
Typeid = 2
SELECT * FROM 'content' WHERE 'tags' IN (3, 14) order by 'time' desc limit 10
SELECT * FROM 'content' WHERE 'lid' IN (7, 12) order by 'time' desc limit 10
SELECT * FROM 'content' WHERE 'typeid' = '2' order by 'time' desc limit 10
Ten articles on the front-end
It was originally prepared and divided into three times, and each time taking 10 records is the safest
Think about it later... it is also troublesome to merge arrays or something. The point is to take too much data, but the front-end only needs 10
So in another sentence
SELECT * FROM 'video _ content' WHERE 'tags' IN (3, 14) or 'lid' IN (3) or 'typeid' = 2 LIMIT 10
However, it seems that you can rank again by TAG> Collection> category...
How can I request it?
The requirement seems quite troublesome. because 50% of the lower part of the page displays related articles, it is very important to operate
------ Solution --------------------
It is not good to use or not in SQL statements;
If the data does not need to be too timely
Cache the data with the combination of your three SQL statements for a period of time (half an hour, one hour, or even a little longer)
Because your data is dead data, no page views, no comment, etc.
------ Solution --------------------
Do you mean that if you want to get 10 tags, you should first get 10 Tags. if not, you should get lib and then type?
If so, will your SQL be faulty!
------ Solution --------------------
Use full-text search