The Yet Another Related Posts Plugin algorithmEXPLAINED! mitcho (Michael 芳貴 Erlewine) http://mitcho.com, @themitcho WordCamp Phoenix, January 29, 2011
YARPP! Over 750,000 downloads on wordpress.org! Thank you!
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 traﬃc on Matt Mullenweg your blog because when they come in just to one entry, they'll see this other stuﬀ going on.
reference entry: VISITOR Taiwan travel tips My trip to Greece Nikon D90 review Writing your own WordPress plugin THE POOL 10 Great Eats in Phoenix 20 ways to use Quora now Fluid dynamics in 10 min My thoughts on Twitter I love my iPhone! Living oﬀ the grid
The criteria: SCORES: • Title keywords* 2.7 • Content body keywords* 3.2 • Tags 1 • Categories 2 * a value computed by a MySQL FULLTEXT MATCH of the reference entries top 20 keywords against the pool entries full values
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! WEIGHTS: 1 2 1 0
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 speciﬁed number of results • A feature, not a bug • Not symmetric, not transitive
Please read: Optimization tips in the FAQ Smart caching: • Added in YARPP 3.0, May 2009 • Caches the relatedness relation results in a custom table
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/