473,625 Members | 2,600 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MATCH AGAINST HELP match exact word

I want to do the equivalent of

SELECT id from TABLE WHERE text='text'
only fast solution I found is:
SELECT id,text from TABLE WHERE MATCH(text) AGAINST('value' IN BOOLEAN
MODE) HAVING text='value'
Is there a better way to do that? Cause using having needs me to add a
column in select wich is a problem in some cases.
It has to return the EXACT WORD MATCH. so only rows containing the
exact "value" content in the text column will be returned.
thanks

Aug 9 '06 #1
4 11224

<jm********@inf ogt2000.comwrot e in message
news:11******** **************@ b28g2000cwb.goo glegroups.com.. .
I want to do the equivalent of

SELECT id from TABLE WHERE text='text'
only fast solution I found is:
SELECT id,text from TABLE WHERE MATCH(text) AGAINST('value' IN BOOLEAN
MODE) HAVING text='value'
Is there a better way to do that? Cause using having needs me to add a
column in select wich is a problem in some cases.
It has to return the EXACT WORD MATCH. so only rows containing the
exact "value" content in the text column will be returned.
Normally string comparisons are not case sensitive. But you can easily
force a case sensitive comparison using the BINARY keyword:

SELECT 'abc' = 'aBc';
Returns True because it does a case insensitive compare

SELECT BINARY 'abc' = 'aBc';
Returns False because BINARY forces the compare to be case sensitive.

Your example:
SELECT id
FROM TABLE {SomeTable}
WHERE BINARY 'We demand an EXACT match!' = {SomeTextField}

If your text field is char or varchar, you can also give it the field the
BINARY attribute.
This overrides the default, case insensitive, database behaviour for string
comparisons and you can leave out the BINARY keyword from the WHERE. I
don't like this myself. It is non-standard behaviour and I would rather see
the BINARY declared explicitly in the query.

Thomas Bartkus



Aug 9 '06 #2
the problem is my field is FULLTEXT

doing just equal comparision is not fast enough.

Im dealing with big tables here...

We changed a few fields to fulltext, for searches, but that field wich
is the 'username' field needs to be exactly matched for a few things.

using MATCH AGAINST is fastest way, but I dont think this allows exact
matches for some reason. So if anyone could help I'd appreciate.

Aug 10 '06 #3

"jmichel" <jm********@inf ogt2000.comwrot e in message
news:11******** *************@p 79g2000cwp.goog legroups.com...
the problem is my field is FULLTEXT

doing just equal comparision is not fast enough.

Im dealing with big tables here...

We changed a few fields to fulltext, for searches, but that field wich
is the 'username' field needs to be exactly matched for a few things.

using MATCH AGAINST is fastest way, but I dont think this allows exact
matches for some reason. So if anyone could help I'd appreciate.
"FULLTEXT searches are not case sensitive."
That would disqualify FULLTEXT indexing as a means to speed up the exact,
case sensitive (BINARY!) match you demand. You requirement is for a BINARY
match.

If there is a way to have your cake and eat it too -
I'm afraid I wouldn't know it!
Thomas Bartkus
Aug 10 '06 #4

Thomas Bartkus wrote:
"jmichel" <jm********@inf ogt2000.comwrot e in message
news:11******** *************@p 79g2000cwp.goog legroups.com...
the problem is my field is FULLTEXT

doing just equal comparision is not fast enough.

Im dealing with big tables here...

We changed a few fields to fulltext, for searches, but that field wich
is the 'username' field needs to be exactly matched for a few things.

using MATCH AGAINST is fastest way, but I dont think this allows exact
matches for some reason. So if anyone could help I'd appreciate.

"FULLTEXT searches are not case sensitive."
That would disqualify FULLTEXT indexing as a means to speed up the exact,
case sensitive (BINARY!) match you demand. You requirement is for a BINARY
match.

If there is a way to have your cake and eat it too -
I'm afraid I wouldn't know it!
Thomas Bartkus
forget about case sentitive thats not important, I just dont want the
exact word Im looking for:

if I search for "jessica" I dont want it to return "jessica-alba" I
just want "jessica" or "JesSiCa" or any other non case-sensitive match
of that word.

so far "jessica-alba" is returned and thats why I use the HAVING clause
too

Aug 10 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
3002
by: vze29xhy | last post by:
I have searched the existing responses in this forum and others and could not find a solution. I have a database on MySQL server Version "4.0.13". My table structure is as follows TABLE1:MusicCD This table has three columns - UPC, Title, ExtendedTitle TABLE2: Artist This table has three columns - ArtistID, ArtistName, ArtistOtherName
6
56810
by: Mark Findlay | last post by:
I am trying to figure out how to set up my reg exp search so that the search will only match on the exact word. Here is the current problem code: Word1 = "RealPlayer.exe" Word2 = "Player.exe" RegExp re = Word2; if (re.Find(Word1))
19
2148
by: Tom Deco | last post by:
Hi, I'm trying to use a regular expression to match a string containing a # (basically i'm looking for #include ...) I don't seem to manage to write a regular expression that matches this. My (probably to naive) approach is: p = re.compile(r'\b#include\b) I also tried p = re.compile(r'\b\#include\b) in a futile attempt to use a backslash as escape character before the #
6
3522
by: lawrence k | last post by:
Wierd. Go to this page: http://www.ihanuman.com/search.php and search for "yoga" This query gets run: SELECT * FROM albums WHERE MATCH(name,description) AGAINST ('yoga') ORDER BY id DESC
12
2663
by: ross.oneill | last post by:
Hi, Is there any function in php that will match a word exactly and if it finds it, it returns true. For example if I search for "CA" strVar = "Bob is from Los Angeles CA" - return true strVar "Bob is from Canada" -- returns false
1
1940
by: Archanak | last post by:
Hi, I want to match an exact word/phrase in mysql. I don't know weather i have to use "LIKE" syntax or "RLIKE" syntax. How do i proceed further?
5
9709
by: nse111 | last post by:
Hey yaaaaaaa guys n gals! I want to know how I can match a whole word within a string using php. these are the results returned by the mysql query: tree:sweet:house:gate:tent candy:lollipop:choco:street:child i want to search the word 'tree' wich I take from the user dynamically.
12
13002
by: Archanak | last post by:
Hi, I have a word like this: "Rna binding proteins" and i want to match this exact phrase. I have written code like this: $sentence="Overall, the participation of additional RNA binding proteins in controlling beta-F1-ATPase expression."; $word="RNA binding proteins";
4
5269
by: Marek Kubica | last post by:
Hi, I am trying to get this stuff working, but I still fail. I have a format which consists of three elements: \d{4}M?-\d (4 numbers, optional M, dash, another number) EMPTY (the <EMPTYtoken) (the <PAGEBREAKtoken. The line may contain whitespaces, but nothing else)
0
8251
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8635
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8352
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8494
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7178
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5570
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2614
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1800
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1496
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.