473,385 Members | 1,542 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to use full text search with multiple words?

160 100+
Hi
Recently i came to know about full text search in Mysql. It is like this

Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM tablename WHERE MATCH(name) AGAINST ('john') 
  2.  
it will show results where it find word 'john' in field 'name'.

I have very simple question. Is that possible that it also fetch result where data is like this

Expand|Select|Wrap|Line Numbers
  1. johnwaugh
  2. waugh
  3. strauss
  4. Mr john
  5.  
Now i want to fetch result not only Mr john but also johnwaugh. In short only beginning of word should enough and it should give same results of this query

Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM tablename WHERE name Like 'john%' 
  2.  
Is that possible in full text search? Or i have to use Like for this?
Please give me some suggestion.
Mar 10 '11 #1

✓ answered by JKing

Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM tablename WHERE MATCH(name) AGAINST ('john*' IN BOOLEAN MODE)
  2.  

4 6169
JKing
1,206 Expert 1GB
The MATCH AGAINST functions do not accept wildcards. However you could use an OR in your where clause to perform both lookups.

Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM tablename WHERE MATCH(name) AGAINST ('john') OR name LIKE '%john%'
  2.  
Correction: Fulltext searches can contain certain wild cards. You must do a search IN BOOLEAN MODE. The wildcard can only be appended to the phrase. This means it will find johnson or johnny but not the_john.
Mar 10 '11 #2
waqasahmed996
160 100+
Thanks a lot for your reply. Yes we use different options in Boolean. Is there anything that i can use 'IN BOOLEAN MODE' which check just word beginning and give same result as
Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM tablename WHERE name LIKE 'john%'
  2.  
OR i have to use LIKE
Mar 11 '11 #3
JKing
1,206 Expert 1GB
Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM tablename WHERE MATCH(name) AGAINST ('john*' IN BOOLEAN MODE)
  2.  
Mar 11 '11 #4
waqasahmed996
160 100+
Yes thats what i am asking. Thanks a lottt. You really help me a lot. Thanks again
Mar 11 '11 #5

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

Similar topics

4
by: dave | last post by:
I am wondering if the following can be done. I want to setup a search page that utilizes full text searching in sql2000. I want the user to type in say "where is bill" and have the query search...
0
by: Tracey | last post by:
Hi there, I want to search Japanese characters with Full Text search function. I created a table (tbSearch) for Full-text search on SQL 2000, English Win2k Server. The table contains 4 fields,...
3
by: Trevor Fairchild | last post by:
I'm trying to execute a full-text query from a vb.net web application. The problem I have is that in SQL Server, the syntax for a full-text search is SELECT * FROM table WHERE CONTAINS( *, '...
1
by: arikatla | last post by:
We are using SQL Server 2000 database (with sp3) and recently we faced an interesting issue with full text search. According to SQLServer help page "AND | AND NOT | OR Specifies a logical...
2
by: Gellert, Andre | last post by:
Hello, we upgraded our PostgreSQL from 7.2 to 7.4, because we want to use the enhanced full-text searches, which should be build in now. I can't find any informations how to implement an...
0
by: coosa | last post by:
Dear all, I'm using MS SQL Server 2005 and i have a full-text search issue; Let's say i have table1, table2 and table 3; for each, some full-text indices have been created. The issue is that i...
1
by: RAM | last post by:
Hello, I have installed SQL Server 2005 Express Edition Advanced Services and SQL Server 2005 Express Edition Toolkit SP1. I cannot use full-text search. When I called: exec sp_fulltext_service...
0
by: Skywick | last post by:
Hi I am trying to do a full text search with a column name for the search term. I can do this using LIKE with: SELECT tblContent.ID FROM tblContent INNER JOIN #keywords ON tblContent.words...
0
by: Aquila Deus | last post by:
Hi all! Does anyone know a working full-text search engine for CJK text? I have tried several but all of them seem to suck: - MySQL full-text: cannot understand chinese "words" at all -...
8
by: Sham | last post by:
I am trying to perform the following query on a table that has been indexed using Full Text Search. The table contains multiple columns than have been indexed. (Below, all xml columns are...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.