This is YARPP 3.1.3 (and 3.1.4 beta)
Here is the detail:
I have a post, ID 9812. YARPP finds 3 related posts for it.
The info gets cached and you can see that 9812 has three IDs associated with it in the cache:
mysql> select reference_ID,ID from wp_yarpp_related_cache order by reference_ID;
+————–+——+
| reference_ID | ID |
+————–+——+
| 9812 | 0 |
| 9812 | 7761 |
| 9812 | 8032 |
| 9812 | 8049 |
Now I go browsing around as a user (not admin) looking at some other posts and the cached info stays the same…
UNTIL I view some post where YARPP finds that good old 9812 is related to the newly-browsed post.
YARPP deletes the info from the cache table for 9812, and instead we just have an indicator that some posts “point to 9812” but 9812 no longer points to any other posts:
+————–+——+
| reference_ID | ID |
+————–+——+
| 3548 | 9812 |
| 4226 | 9812 |
| 6351 | 9812 |
| 7987 | 9812 |
| 8764 | 9812 |
| 9708 | 9812 |
No author has changed anything in the system in the meanwhile. Nothing has changed except that some user has browsed to a page that YARPP determines is related to 9812. YARPP has deleted the 9812 info.
So 9812 now has to have its YARPP cache rebuilt for the next site visitor. In my case, this involves 2 MySQL processes and about 15 seconds of CPU time because of the size of the blog!
In sites with large numbers of posts (this one has thousands), and where the last few posts might all be somewhat related, YARPP can end up causing a lot of churning because it’s so frequently deleting the posts, even though no posts have actually changed.
Here’s what happens when the visitor browses back to 9812 – showing that the cache entries had to be re-created again.
+————–+——+
| reference_ID | ID |
+————–+——+
| 3548 | 9812 |
| 4226 | 9812 |
| 6351 | 9812 |
| 7987 | 9812 |
| 8764 | 9812 |
| 9708 | 9812 |
| 9812 | 0 |
| 9812 | 7761 |
| 9812 | 8032 |
| 9812 | 8049 |
I wonder if maybe YARPP doesn’t have to delete 9812 at all just because it discovered that some other posts think THEY are related to 9812.
]]>Is there any way we can display, or have the option to display, our related posts for each post in our Main Index and Archives as well?
I show the full bodies of all my posts in my main index, so people rarely see a single post view, which is the only way they can currently access the related posts feature other than the RSS feed. Obviously, it’d be great if they could access the related posts for each post without having to go to the single post view.
Thanks!
]]>WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'and date > date_sub(now(),interval 600 minute)' at line 1]
select count(*) as count from wp_yarpp_related_cache where reference_ID = and date > date_sub(now(),interval 600 minute)
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]
select post_content from wp_posts where ID =
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]
select post_title from wp_posts where ID =
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' ',' ') on duplicate key update date = now(), body = ' ', title = ' '' at line 1]
insert into wp_yarpp_keyword_cache (ID,body,title) values (,' ',' ') on duplicate key update date = now(), body = ' ', title = ' '
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'and ID != 0' at line 1]
select ID from wp_yarpp_related_cache where reference_ID = and ID != 0
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]
delete from wp_yarpp_related_cache where reference_ID =
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]
select body from wp_yarpp_keyword_cache where ID =
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]
select post_content from wp_posts where ID =
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]
select post_title from wp_posts where ID =
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' ',' ') on duplicate key update date = now(), body = ' ', title = ' '' at line 1]
insert into wp_yarpp_keyword_cache (ID,body,title) values (,' ',' ') on duplicate key update date = now(), body = ' ', title = ' '
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]
select body from wp_yarpp_keyword_cache where ID =
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]
select title from wp_yarpp_keyword_cache where ID =
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]
select post_content from wp_posts where ID =
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]
select post_title from wp_posts where ID =
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' ',' ') on duplicate key update date = now(), body = ' ', title = ' '' at line 1]
insert into wp_yarpp_keyword_cache (ID,body,title) values (,' ',' ') on duplicate key update date = now(), body = ' ', title = ' '
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]
select title from wp_yarpp_keyword_cache where ID =
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' ID, (0+ (MATCH (post_content) AGAINST ('')) * 3+ (MATCH (post_title) AGAINST ('' at line 1]
insert into wp_yarpp_related_cache (reference_ID,ID,score) SELECT , ID, (0+ (MATCH (post_content) AGAINST ('')) * 3+ (MATCH (post_title) AGAINST ('')) * 1+ COUNT( DISTINCT tagtax.term_taxonomy_id ) * 1+ COUNT( DISTINCT cattax.term_taxonomy_id ) * 1) as score from wp_posts left join wp_term_relationships as blockrel on (wp_posts.ID = blockrel.object_id) left join wp_term_taxonomy as blocktax using (<code>term_taxonomy_id</code>) left join wp_terms as blockterm on (blocktax.term_id = blockterm.term_id and blockterm.term_id in (242)) left JOIN wp_term_relationships AS thistag ON (thistag.object_id = ) left JOIN wp_term_relationships AS tagrel on (tagrel.term_taxonomy_id = thistag.term_taxonomy_id AND tagrel.object_id = wp_posts.ID) left JOIN wp_term_taxonomy AS tagtax ON ( tagrel.term_taxonomy_id = tagtax.term_taxonomy_id AND tagtax.taxonomy = 'post_tag') left JOIN wp_term_relationships AS thiscat ON (thiscat.object_id = ) left JOIN wp_term_relationships AS catrel on (catrel.term_taxonomy_id = thiscat.term_taxonomy_id AND catrel.object_id = wp_posts.ID) left JOIN wp_term_taxonomy AS cattax ON ( catrel.term_taxonomy_id = cattax.term_taxonomy_id AND cattax.taxonomy = 'category') where (post_status IN ( 'publish', 'static' ) and ID != '') and post_password ='' and post_type IN ('post') group by id having score >= 2.5 and count(blockterm.term_id) = 0 and COUNT( DISTINCT tagtax.term_taxonomy_id ) >= 1 order by score desc limit 10 on duplicate key update date = now()
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0,0)' at line 1]
insert into wp_yarpp_related_cache (reference_ID,ID,score) values (,0,0)
<strong>Related posts:</strong><br /><ul><li><a href='https://myserver.net/2009/04/25/example-post-1/' rel='bookmark' title='Permanent Link: Example post 1'>Example post 1 <abbr title="0.000000 is the YARPP match score between the current entry and this related entry. You are seeing this value because you are logged in to WordPress as an administrator. It is not shown to regular visitors.">(0)</abbr></a></li><li><a href='https://myserver.net/2009/04/26/example-post-2/' rel='bookmark' title='Permanent Link: Example post 2'>Example post 2 <abbr title="0.000000 is the YARPP match score between the current entry and this related entry. You are seeing this value because you are logged in to WordPress as an administrator. It is not shown to regular visitors.">(0)</abbr></a></li><li><a href='https://myserver.net/2009/04/25/example-post-3/' rel='bookmark' title='Permanent Link: Example post 3'>Example post 3 <abbr title="0.000000 is the YARPP match score between the current entry and this related entry. You are seeing this value because you are logged in to WordPress as an administrator. It is not shown to regular visitors.">(0)</abbr></a></li><li><a href='https://myserver.net/2009/04/25/example-post-4/' rel='bookmark' title='Permanent Link: Example post 4'>Example post 4 <abbr title="0.000000 is the YARPP match score between the current entry and this related entry. You are seeing this value because you are logged in to WordPress as an administrator. It is not shown to regular visitors.">(0)</abbr></a></li><li><a href='https://myserver.net/2009/04/23/example-post-5/' rel='bookmark' title='Permanent Link: Example post 5'>Example post 5 <abbr title="0.000000 is the YARPP match score between the current entry and this related entry. You are seeing this value because you are logged in to WordPress as an administrator. It is not shown to regular visitors.">(0)</abbr></a></li><li><a href='https://myserver.net/2009/02/16/example-post-6/' rel='bookmark' title='Permanent Link: Example post 6'>Example post 6 <abbr title="0.000000 is the YARPP match score between the current entry and this related entry. You are seeing this value because you are logged in to WordPress as an administrator. It is not shown to regular visitors.">(0)</abbr></a></li><li><a href='https://myserver.net/2009/04/20/example-post-7/' rel='bookmark' title='Permanent Link: Example post 7'>Example post 7 <abbr title="0.000000 is the YARPP match score between the current entry and this related entry. You are seeing this value because you are logged in to WordPress as an administrator. It is not shown to regular visitors.">(0)</abbr></a></li><li><a href='https://myserver.net/2009/04/22/example-post-8/' rel='bookmark' title='Permanent Link: Example post 8'>Example post 8 <abbr title="0.000000 is the YARPP match score between the current entry and this related entry. You are seeing this value because you are logged in to WordPress as an administrator. It is not shown to regular visitors.">(0)</abbr></a></li><li><a href='https://myserver.net/2009/04/22/example-post-9/' rel='bookmark' title='Permanent Link: Example post 9'>Example post 9 <abbr title="0.000000 is the YARPP match score between the current entry and this related entry. You are seeing this value because you are logged in to WordPress as an administrator. It is not shown to regular visitors.">(0)</abbr></a></li><li><a href='https://myserver.net/2009/04/22/example-post-10/' rel='bookmark' title='Permanent Link: Example post 10'>Example post 10 <abbr title="0.000000 is the YARPP match score between the current entry and this related entry. You are seeing this value because you are logged in to WordPress as an administrator. It is not shown to regular visitors.">(0)</abbr></a></li></ul>
]]>I use UTF-8.
]]>Thanks
Stephen,
This seems like a have to have feature! There is no reason that we need related posts in real time. I would much rather setup a job to run once per day or once per week for that matter and then again for any new post which is created.
]]>I’m trying to combine this plug-in with the YAPB (Yet Another Photo Blog)-plugin, so that I can show related photos to each single photo.
To retrieve this I need a way to get the post-objects instead of the outputted xhtml – Something like get_related_posts(). Is this possible?
Cheers,
Asger
I simply want to have 4 or 5 related posts displayed as thumbnails rather than text links.
Does anyone know of a plugin that does this or another way to achieve this?
Thanks.
]]>In other themes, this is accomplished by calling a function wp32_related_posts apparently, but using this same code in Carrington doesn’t seem to work, and I can’t find where that related_posts function resides in the other themes to begin with.
Has anyone added this to the Carrington theme that wouldn’t mind sharing?
]]>I’d like to display a list of posts that share the tags of the current post. Not as keywords but as list of Post tiles.
Also, I’d like to accompany the post titles with the data from a custom field.
Something like this in the body of the current post is what I’m aiming for:
I’m drawing a blank on this at the moment so any pointers would be a big help.
Matt
]]>