Date post: | 05-Dec-2014 |
Category: |
Technology |
Upload: | michael-yoshitaka-erlewine |
View: | 8,011 times |
Download: | 1 times |
The Yet Another Related Posts Plugin algorithm
mitcho (Michael 芳貴 Erlewine)http://mitcho.com, @themitchoWordCamp Phoenix, January 29, 2011
EXPLAINED!
Over 750,000 downloads on wordpress.org! Thank you!
YARPP!
One of my favorites I just activated on my blog is called Yet Another Related Posts Plugin...
I've been blogging seven or eight years now so I have a lot of archives, and it actually surprises me sometimes when I blog about something and I visit the permalink to see I've written about it before... and it also increases the traffic on your blog because when they come in just to one entry, they'll see this other stuff going on.
Matt Mullenweg
Great features like...
Templating:• Uber-customize the related posts display
• Write templates just like for themes
http://phillprice.com http://elliottgoodman.com
The real secret to success:
The algorithm
My trip to Greece
My thoughts on Twitter
20 ways to use Quora now
I love my iPhone!
Fluid dynamics in 10 min
10 Great Eats in Phoenix
Writing your own WordPress plugin
Nikon D90 review
Living off the grid
“THE POOL”
Taiwan travel tipsVISITORreference entry:
What’s “related”?CC-BY-NC-ND http://www.flickr.com/photos/twcollins/109069524/
The criteria:
• Title keywords*
• Content body keywords*
• Tags
• Categories
* a value computed by a MySQL FULLTEXT MATCH of the reference
entries’ top 20 keywords against the pool entries’ full values
2.73.2
1
2
SCORES:
The “match score”:A weighted sum of the criteria:
2.7 × 1 + 2.8 × 2 + 1 x 1 + 2 x 0 = 9.3
9.3 > 7 (“match threshold”) so related!
12
1
0
WEIGHTS:
tl;dr:• A good, organic sense of “relatedness”
• Default settings are pretty good :)
• Admins can see match scores to tweak
match threshold
The “relatedness” relation:
• Sometimes results in less than the specified number of results
• A feature, not a bug
• Not symmetric, not transitive
The future:
Additional criteria?Custom taxonomies, authorship, internal links...CC-BY-SA http://www.flickr.com/photos/x-ray_delta_one/4205453510/
THE QUERY
IS TOO DAMNEXPENSIVE
Smart caching:• Added in YARPP 3.0, May 2009
• Caches the “relatedness” relation
results in a custom table
Please read:Optimization tips in the FAQ
“Smart” caching:
• no need to manage it
• auto-updates on post updates, deletes
• but you can reset it if you want to:
• add &action=flush the YARPP options screen URL (version 3.2)
From cache to Loop:
• Related post display creates is own Loop
• A new WP_Query is created and hijacked
• Write code in templates like a regular
Loop, with extra template tags:
• the_score(), get_the_score()
CC-BY-NC http://www.flickr.com/photos/seadigs/5190768911/
Yet Another RelatedPosts Plugin
3.2AVAILABLE TODAY!http://tinyurl.com/yarppthreetwo
Postmeta caching
• A new caching option̶no more custom tables!
• default is still custom tables
• turn it on with:define('YARPP_CACHE_TYPE','postmeta');
YARPP 3.2:
New cache abstraction
• Cache is now a global object $yarpp_cache
• Write your own!
• Get info like $yarpp_cache->is_related($postA,$postB);
YARPP 3.2:
Thank you!slides on http://slideshare.net/mitcho
Get the latest:@themitcho, @yarpp
Yet Another Related Posts Plugin
Working hard so you can:
engage • perform • hack