gregerly 192
Recognized Expert New Member
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 there a way of adding relevance to a search, in a way that would make sense for the above senario?
Thanks in advance,
Greg
7 5250 pbmods 5,821
Recognized Expert Expert
Heya, Greg.
If your database uses MyISAM tables, you can use MySQL fulltext searching.
fulltext is good because it offers different format of searches and if you're using the like keyword in your search remove it so that you can direct search....
gregerly 192
Recognized Expert New Member
This looks like what I've been looking for. One thing I still don't understand about FULLTEXT searches, lets say I have four records:
1. Italian Food
2. Mexican Food
3. German Food
4. Chinese Food
Lets say my search is "Italian Food", where the word "Food" is in all results, but "Italian" is in only one. Does mysql filter out the three records that do not have "Italian" in the result?
I'm thinking this is definelty the way to go, I just am trying to wrap my head around exactly how it works.
Thanks,
Greg
A natural language search interprets the search string as a phrase in natural human language (a phrase in free text). There are no special operators. The stopword list applies. In addition, words that are present in more than 50% of the rows are considered common and do not match. Full-text searches are natural language searches if the IN NATURAL LANGUAGE MODE modifier is given or if no modifier is given.
So if you use the IN NATURAL LANGUAGE MODE option it should give you only 1 result: Italian Food, from that particular list.
Anyway you can use something like: -
SELECT ... MATCH () AGAINST() as score from .... WHERE MATCH () AGAINST () order by score desc;
And use only the first x rows, that contain the x most relevant results, if you don't want to show results with low relevance.
This looks like what I've been looking for. One thing I still don't understand about FULLTEXT searches, lets say I have four records:
1. Italian Food
2. Mexican Food
3. German Food
4. Chinese Food
Lets say my search is "Italian Food", where the word "Food" is in all results, but "Italian" is in only one. Does mysql filter out the three records that do not have "Italian" in the result?
I'm thinking this is definelty the way to go, I just am trying to wrap my head around exactly how it works.
Thanks,
Greg
Yes mysql filters out the other foods... So what have you decided did you use the full text or the direct search? in fulltext you use the keyword match() and against()...
gregerly 192
Recognized Expert New Member
Yes mysql filters out the other foods... So what have you decided did you use the full text or the direct search? in fulltext you use the keyword match() and against()...
I think i'm going with the full text search. Seems to be what I'm looking for. I'll post back here when I'm done and let yall know how it works.
Thanks again for the help. You guys/gals are a wealth of info.
Greg
pbmods 5,821
Recognized Expert Expert
Heya, Greg.
Thanks again for the help. You guys/gals are a wealth of info.
We aim to please.
Good luck with your project, and if you ever need anything, post back anytime :)
Sign in to post your reply or Sign up for a free account.
Similar topics |
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...
|
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.
...
|
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...
|
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...
|
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...
| |
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...
|
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...
|
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...
|
by: gregerly |
last post by:
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...
|
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...
|
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...
| |
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...
|
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,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |