473,750 Members | 2,213 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FullText Relevance sorting

Given the SQL shouldn't the records be sorting by score ie. relevance? I
thought if "WHERE MATCH" is used it will sort that way. Thanks

mysql> SELECT `page`.`title` , MATCH ( `title` , `descrip` ) AGAINST (
'+code+nasdac' IN BOOLEAN MODE ) AS SCORE FROM `page` WHERE MATCH (
`title` , `descrip` ) AGAINST ( '+code+nasdac' IN BOOLEAN MODE );
+---------------------------------------------+-----------------+
| title | SCORE |
+---------------------------------------------+-----------------+
| Code 99 Specifications | 1.3333333730698 |
| Centralized Management System | 1 |
| Report Number Series | 1.3333333730698 |
| Reviewing Documents for Release | 1 |
+---------------------------------------------+-----------------+
4 rows in set (0.00 sec)
Jul 23 '05 #1
1 6174
leegold wrote:
Given the SQL shouldn't the records be sorting by score ie. relevance? I
thought if "WHERE MATCH" is used it will sort that way.


http://dev.mysql.com/doc/mysql/en/fulltext-boolean.html
"[Boolean full-text searches] do not automatically sort rows in order of
decreasing relevance."

When you use BOOLEAN MODE, the relevance value returned is always 1.0.
So the sort order becomes unpredictable.

There's a user comment (by Patrick O'Lone) on the following web page
that explains this and gives an example of a workaround:

http://dev.mysql.com/doc/mysql/en/fulltext-search.html

Regards,
Bill K.
Jul 23 '05 #2

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

Similar topics

1
2670
by: ap49 | last post by:
Hi, I've just started to implement a FULLTEXT search script in PHP. I have read that the relevance rating should not directly be used to create a rating (as a percentage say) for the results you may return to a user. Is there an effective algorithm whereby some normalisation etc. could effectively be used to provide at least a "rough" guide?
1
1946
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. Any snips, ideas or links appreciated. Thanks
0
1286
by: Matt W | last post by:
Hi all, I'm planning to use MySQL's full-text search for my forum system (possibly 5+ million posts). I've been playing with it a lot lately to see the performance and functionality and have some suggestions/questions. First, since a few of you may be wanting to know, here is a thread where I was doing some speed/optimization tests and stuff with 3 million posts: http://www.sitepointforums.com/showthread.php?threadid=69555
0
476
by: Phil Powell | last post by:
Retracing my problem leads me to believe I never successfully created fulltext indexes for MySQL 3.23.58 MyISAM tables. I went to the MySQL manual and was able - or so I thought - to create them, however, my fulltext search queries fail in 3.23.58 but the exact queries (with same data) work perfectly in 4.0.10. --...
0
1267
by: Leif Wessman | last post by:
I have a very large table with book titles. How can I use Mysql to do a fulltext search that returns rows that only contains the words that the user searched for, ordered by relevance? Note, rows that contains some of the words, but not all - should NOT be in the result. My database contains >5 000 000 rows. So speed is an issue. The index itself may be very large if needed. What's the best way to achive this with MySQL? Leif
0
1311
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. Any snips, ideas or links appreciated. Thanks
1
2450
by: leegold | last post by:
Show full header Is there any way to make relevance when using boolean mode more useful? If not, are there plans in the Fulltext development "todo" for making it useful? I'm thinking of just counting the keyword occurences in records with a PHP script somehow and using that to order the records somehow. Or doing a non boolean fulltext search w/relevance first and then melding that in somehow with a boolean search. See my results...
0
519
by: Alex Glass | last post by:
I have a large contacts table with about 30 columns of text fields and 5 fulltext indexes spanning the different sections of the table. I'm curious if anyone could suggest a better way to find rows in the table based on text entered by the user. It also would be nice if wildcards could be supported like "beginning*". The query I have built crashed mysqlnt-d a few times but I was unable to determine what triggered the crash. I believe it...
3
1399
nathj
by: nathj | last post by:
Hi, I am just trying to develop a search system for my website. The PHP side of things is no trouble at all. I have also set up what I think are appropriate FULLTEXT indices on the tables I will need to search. I was just trying things out and have got a bit confused. What I think should be happening, based on what I've read, is not happening. I have a table - tbl_resource, on this table there is FULLTEXT index on three fields -...
0
8838
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9577
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9396
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...
0
9256
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
8260
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...
1
6804
isladogs
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6081
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
3322
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
2
2804
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.