Jump to content

SELECT MATCH AGAINST asterisk


raduenea
Go to solution Solved by raduenea,

Recommended Posts

Hello,

I have the following code that should select all strings that start with "rog" (like rogers, etc).

							SELECT 
								user_id, 
								first_name AS name,
								gender
							FROM 
								user_details 
							WHERE 
								MATCH (first_name) AGAINST('rog*') 

The problme it's that  shows me zero results. In first_name column I have a lot of words with "rogers". 

first_name column have Fulltext assign. 

If I use just "...AGAINST ('rogers')" it return corect data.

It's something wrong with my sentence? 

Thank you

Link to comment
Share on other sites

These are the results I get (wordlist contains 351,100 records)

 

$t1 = microtime(1);
$res = $db->query("SELECT word FROM wordlist WHERE MATCH (word) AGAINST ('sang*' IN BOOLEAN MODE)");
$t2 = microtime(1);
printf('Query 1 :  %0.4f seconds<br>', $t2 - $t1);  

$t1 = microtime(1);
$res = $db->query("SELECT word FROM wordlist WHERE word LIKE 'sang%'");
$t2 = microtime(1);
printf('Query 2 :  %0.4f seconds<br>', $t2 - $t1);  

results (74 words found)

Query 1 : 0.0026 seconds
Query 2 : 0.0005 seconds

 

  • Like 1
  • Great Answer 1
Link to comment
Share on other sites

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.