the yet another related posts plugin algorithm explained!

20
The Yet Another Related Posts Plugin algorithm mitcho (Michael 貴 Erlewine) http://mitcho.com, @themitcho WordCamp Phoenix, January 29, 2011 EXPLAINED!

Upload: michael-yoshitaka-erlewine

Post on 05-Dec-2014

8.011 views

Category:

Technology


1 download

DESCRIPTION

 

TRANSCRIPT

Page 1: The Yet Another Related Posts Plugin algorithm EXPLAINED!

The Yet Another Related Posts Plugin algorithm

mitcho (Michael 芳貴 Erlewine)http://mitcho.com, @themitchoWordCamp Phoenix, January 29, 2011

EXPLAINED!

Page 2: The Yet Another Related Posts Plugin algorithm EXPLAINED!

Over 750,000 downloads on wordpress.org! Thank you!

YARPP!

Page 3: The Yet Another Related Posts Plugin algorithm EXPLAINED!

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

Page 4: The Yet Another Related Posts Plugin algorithm EXPLAINED!

Great features like...

Templating:• Uber-customize the related posts display

• Write templates just like for themes

http://phillprice.com http://elliottgoodman.com

Page 5: The Yet Another Related Posts Plugin algorithm EXPLAINED!

The real secret to success:

The algorithm

Page 6: The Yet Another Related Posts Plugin algorithm EXPLAINED!

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:

Page 7: The Yet Another Related Posts Plugin algorithm EXPLAINED!

What’s “related”?CC-BY-NC-ND http://www.flickr.com/photos/twcollins/109069524/

Page 8: The Yet Another Related Posts Plugin algorithm EXPLAINED!

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:

Page 9: The Yet Another Related Posts Plugin algorithm EXPLAINED!

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:

Page 10: The Yet Another Related Posts Plugin algorithm EXPLAINED!

tl;dr:• A good, organic sense of “relatedness”

• Default settings are pretty good :)

• Admins can see match scores to tweak

match threshold

Page 11: The Yet Another Related Posts Plugin algorithm EXPLAINED!

The “relatedness” relation:

• Sometimes results in less than the specified number of results

• A feature, not a bug

• Not symmetric, not transitive

Page 12: The Yet Another Related Posts Plugin algorithm EXPLAINED!

The future:

Additional criteria?Custom taxonomies, authorship, internal links...CC-BY-SA http://www.flickr.com/photos/x-ray_delta_one/4205453510/

Page 13: The Yet Another Related Posts Plugin algorithm EXPLAINED!

THE QUERY

IS TOO DAMNEXPENSIVE

Page 14: The Yet Another Related Posts Plugin algorithm EXPLAINED!

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

Page 15: The Yet Another Related Posts Plugin algorithm EXPLAINED!

“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)

Page 16: The Yet Another Related Posts Plugin algorithm EXPLAINED!

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/

Page 17: The Yet Another Related Posts Plugin algorithm EXPLAINED!

Yet Another RelatedPosts Plugin

3.2AVAILABLE TODAY!http://tinyurl.com/yarppthreetwo

Page 18: The Yet Another Related Posts Plugin algorithm EXPLAINED!

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:

Page 19: The Yet Another Related Posts Plugin algorithm EXPLAINED!

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:

Page 20: The Yet Another Related Posts Plugin algorithm EXPLAINED!

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