Jump to content

Recommended Posts

Hi all,

 

I'm working on an application that allows users to post articles about a variety of topics.. what I'm trying to do, is display related or suggested articles once a certain article is opened. So if someone is reading an article about oranges, I'd like to pull a few similar articles and display them as suggested articles on the same page.

 

I'd like to avoid having the author of each article tagging or categorising it.

 

What I was thinking about doing, was to use the logic of a MySQL search script.. and querying the title of an article against the content of other articles that contain all or some of the terms in the query.

 

Ideally, I'd like to somehow compare the level of similarity between various articles and have them displayed accordingingly.

 

Any suggestions? Or, would someone happen to know of where I could read up on this? May be some tutorials?

Link to comment
https://forums.phpfreaks.com/topic/168144-phpmysql-displaying-related-data/
Share on other sites

If I have a category column, wouldn't I still need to compare the terms in that column that are associated with one article to the terms of another? If this is the case, wouldn't it be the same as comparing the actual content of one article to that of another?

 

Either way, if I'm comparing one field of a column to another.. would it make sense to use the 'similar_text' function PHP offers?

Would it matter? I mean, if I'm using a built in PHP function like the similar_text one.. why would it matter if the string has 3 words or 300 words, aside from the speed difference.

 

So I guess, a better question would be.. is the similar_text function a good way to go about comparing data stored in different fields of a database table?

im more concerned about your use of mysql resources. sure php can handle comparisons, however you are asking the mysql server for a ton of info. you are guaranteed slow performance. and if you are planning on having a lot of articles i would advise against that. if its like you say, and the speed difference doesnt matter than go for it.

 

in terms of php there are a ton of ways to compare strings. im not familiar with the similar_text function, however the manual covers them all in good detail. sorry i couldnt be of any more help.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.