473,569 Members | 2,770 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP / MySQL relevance in searching

gregerly
192 Recognized Expert New Member
Hello,

I appologize as I've posted this in the PHP forum as well, but I think it is relevant here as well.

I've got a problem with a website search function. PHP for the front end, MySQL for the backend. The search function searches a field of keywords. The problem I'm having is that when someone searches for "Italian Food" it's bring back results for other resteraunts that are not italian, but do have the word Food in their keywords. Is there a way of adding relevance to a search, in a way that would make sense for the above senario?

Thanks in advance,

Greg
Jul 12 '07 #1
2 1650
mwasif
802 Recognized Expert Contributor
Use MySQL's FULLTEXT search. You can also use FULLTEXT in BOOLEAN MODE.
Jul 13 '07 #2
Atli
5,058 Recognized Expert Expert
If you can't / won't use a fulltext search, you could always split the search string into words, and search for results for each word, and then rank each result based on how many of the words match it.

For example, if you search for 'Italian food' and restaurant A has the keyword 'FOOD', and restaurant B has both the word 'ITALIAN' and 'FOOD' then you could rank A = 50% and B = 100%, and return the results based on the ranking.
Jul 15 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
1578
by: lawrence | last post by:
I've spent some time going over this page: http://dev.mysql.com/doc/mysql/en/Data_Manipulation.html And so far it seems the answer is no. So I thought I'd ask here. Does anyone know of any built-in search algorithms with MySql? I'm looking for a way to return the results of my last SELECT statement (which uses LIKE) based on the number...
1
1939
by: Hal Halloway | last post by:
How do I change a MYSQL Fulltext relevance value to: 0 to 100%. I'm just thinking about usability for the "average" user - maybe they would like to know...and would not understand the raw value. Any snips, ideas or links appreciated. Thanks
14
1806
by: Domestos | last post by:
Hi, TIA... 1) Need to select all rows from table called fixtures where home_team and away_team is equal to team_code. What SQL select statement would do this? 2) I have a variable called fixture_date in the format dd-MMM-yy (i.e. 02-Mar-05) how do I select the day/month/year into thier own variables using PHP?
4
2735
by: Michi | last post by:
I was wondering what the best solution is for making large numbers of TEXT (or BLOB?) fields searchable. For example, if I have a forum, what is the best way to be able to search for specific words? How about exact phrases? I saw a solution where all words are preindexed in a "dictionary" like table and then another table stores the word...
17
2869
by: chicha | last post by:
Hey people, I have to convert MS Access 2000 database into mysql database, the whole thing being part of this project I'm doing for one of my faculty classes. My professor somehow presumed I knew db's and gave me long list of things to do with that particular database, first thing being that particular conversion. Truth is that I don't know...
2
2364
by: Paul Bramscher | last post by:
What are the mechanisms to make words like a/an/the in text and varchar character fields ignored when performing SELECT and utilizing ORDER BY in SQL queries? I've done some hunting around into documentation on character sets (but they are geared mainly at character-by-character rules) and saw some reference to string collating and stop...
15
4578
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to communicate with a MySQL database table on a web server, from inside of my company's Access-VBA application. I know VBA pretty well but have never...
2
1435
by: Richard Brosnahan | last post by:
I hate asking questions that have probably been answered before, but I have not found a way to conveniently search the archives of this mailing list. So... Can someone tell me how to search this mailing list, short of downloading every month's archive and searching manually? Or, can someone tell me how to easily interface with...
4
1713
by: | last post by:
Hello... i have a table which contains a column named "ask" and a column named "per"... my think is that i want to search in "ask" and echo the data stored in "per" for this entry... How do i do this? Thanx in advance! JBK
7
5260
gregerly
by: gregerly | last post by:
Hello, I've got a problem with a website search function. PHP for the front end, MySQL for the backend. The search function searches a field of keywords. The problem I'm having is that when someone searches for "Italian Food" it's bring back results for other resteraunts that are not italian, but do have the word Food in their keywords. Is...
0
7609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8118
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7666
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6278
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1208
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.