ivopld Posted July 30, 2009 Share Posted July 30, 2009 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? Quote Link to comment Share on other sites More sharing options...
abazoskib Posted July 30, 2009 Share Posted July 30, 2009 maybe you should have a categories column that is indexed for each article i.e. ArticleName Author Category How to Peel an Orange Me fruit,orange,delicious Quote Link to comment Share on other sites More sharing options...
ivopld Posted July 30, 2009 Author Share Posted July 30, 2009 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? Quote Link to comment Share on other sites More sharing options...
abazoskib Posted July 30, 2009 Share Posted July 30, 2009 well think about it. would you rather see if three categorical adjectives match another three adjectives, or would you rather compare a full article to a full article? Quote Link to comment Share on other sites More sharing options...
ivopld Posted July 30, 2009 Author Share Posted July 30, 2009 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? Quote Link to comment Share on other sites More sharing options...
abazoskib Posted July 30, 2009 Share Posted July 30, 2009 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.