Solved

Mysql match() againts() giving some problems to me?

Posted on 2010-11-11
4
306 Views
Last Modified: 2012-05-10
Hello, I have a litle query that I am using to search inside a database, I have a fulltext index for the fields "titulo & descripcion", and the query works... the problem comes when I put something that doesn't exist in the database (like the search I have in the query "280394829038402938409283403409240240849") this shouldn't give results but the problem is that it keeps giving me results... is there something I am doing wrong?

Thank's

SELECT * , MATCH(titulo, descripcion) AGAINST ('280394829038402938409283403409240240849') as coincidencia from preguntas order by coincidencia DESC
0
Comment
Question by:visionari
  • 2
4 Comments
 
LVL 35

Expert Comment

by:Terry Woods
ID: 34116472
The match relevance is returned as a positive floating point number, or 0 for no similarity. It must be deciding there is a small similarity somehow! Try this:

SELECT * , MATCH(titulo, descripcion) AGAINST ('280394829038402938409283403409240240849'  IN BOOLEAN MODE) as coincidencia from preguntas order by coincidencia DESC
0
 

Author Comment

by:visionari
ID: 34130439
mmh, not really working for me, all I get is 0 in coincidencia even in keywords that exist...
0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 34133892
you have to put that into the WHERE also!
SELECT * , MATCH(titulo, descripcion) AGAINST ('280394829038402938409283403409240240849') as coincidencia 
  FROM preguntas 
 WHERE MATCH(titulo, descripcion) AGAINST ('280394829038402938409283403409240240849') 
ORDER BY coincidencia DESC 

Open in new window

0
 

Author Closing Comment

by:visionari
ID: 34171859
Thank's!
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now