Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get related content WITHOUT using tags?

Tags:

php

I need a way to get related content without using tags because in my case there are too many tags and those tags are inserted by users ( so in the most case they forgot to use them ).

Youtube do the same thing: if, for example, you are watching a funny video, then youtube show you other funny videos in the related content.

For instance, if the article's title is "Barack Obama, president of USA, go to Miami", I need to get other articles that contain "Barack Obama", "USA", "president" or "Miami" in the title and, if possible, other articles of the same topic.

THIS CAN BE VERY COMPLEX TO DO, so I asked you for some advice.

like image 221
xRobot Avatar asked Nov 13 '22 12:11

xRobot


1 Answers

Possible solution is to use Zend Lucene.
http://framework.zend.com/manual/1.12/en/zend.search.lucene.html

It's an easy to implement search engine that runs entirely in php. You can use it a component separate from Zend Framework, and it's fairly easy to implement.

Index all your contents. Use the (for some reason undocumented) boost feature to make parts of the content that more relevant (IE. title, user tags)
Example here: http://davedash.com/2007/05/29/boosting-terms-in-zend-search-lucene/

Then, use the title as a keyword query and display the x highest scoring results to your users. (making sure to filter the content the user is currently looking at)

For optimization you could cash the search results per page.

You can tweak outcomes:
- What content best describes the content - Boost those items while indexing
- When searching what will you use (Title, User Tag, combination)

like image 159
Jeroen de Lau Avatar answered Nov 15 '22 04:11

Jeroen de Lau