473,651 Members | 3,011 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Does MySql have any built in search functionality

I've spent some time going over this page:

http://dev.mysql.com/doc/mysql/en/Da...ipulation.html

And so far it seems the answer is no. So I thought I'd ask here. Does
anyone know of any built-in search algorithms with MySql?

I'm looking for a way to return the results of my last SELECT
statement (which uses LIKE) based on the number of hits the LIKE came
up with. In other words, I want something like this:

SELECT * FROM mainContent WHERE mainText LIKE '%$matchThis%' ORDER BY
number of matches per entry DESC
Jul 17 '05 #1
6 1583
On Thu, 29 Apr 2004 19:29:50 -0700, lawrence wrote:
I've spent some time going over this page:

http://dev.mysql.com/doc/mysql/en/Da...ipulation.html

And so far it seems the answer is no. So I thought I'd ask here. Does
anyone know of any built-in search algorithms with MySql?

I'm looking for a way to return the results of my last SELECT statement
(which uses LIKE) based on the number of hits the LIKE came up with. In
other words, I want something like this:

SELECT * FROM mainContent WHERE mainText LIKE '%$matchThis%' FROM
mainContent ORDER BY number of matches per entry DESC


You are trying to marry two mutually exclusive conditions: The use of an
RDBMS and "record" sequences. The order in which data is retrieved is
random and inconsistent. In other words if you run a query more than once
there is no guarantee that the results will be in the same order each
time you run it or that the behavior will be consistent from release to
release of an RDBMS.

Now, if you want to know how many rows in the table match your like use
count. e.g. SELECT COUNT(*) FROM mainContent WHERE mainText LIKE
'%$matchThis%';

HTH
Jerry
Jul 17 '05 #2
On Thu, 29 Apr 2004 23:44:27 -0400, Jerry Gitomer wrote:
On Thu, 29 Apr 2004 19:29:50 -0700, lawrence wrote:
I've spent some time going over this page:

http://dev.mysql.com/doc/mysql/en/Da...ipulation.html

And so far it seems the answer is no. So I thought I'd ask here. Does
anyone know of any built-in search algorithms with MySql?

I'm looking for a way to return the results of my last SELECT statement
(which uses LIKE) based on the number of hits the LIKE came up with. In
other words, I want something like this:

SELECT * FROM mainContent WHERE mainText LIKE '%$matchThis%' FROM
mainContent ORDER BY number of matches per entry DESC


You are trying to marry two mutually exclusive conditions: The use of an
RDBMS and "record" sequences. The order in which data is retrieved is
random and inconsistent. In other words if you run a query more than once
there is no guarantee that the results will be in the same order each time
you run it or that the behavior will be consistent from release to release
of an RDBMS.

Now, if you want to know how many rows in the table match your like use
count. e.g. SELECT COUNT(*) FROM mainContent WHERE mainText LIKE
'%$matchThis%';

HTH
Jerry


I had another thought about your problem. If you have sufficient memory
available you could read the query result into an array and then use PHP
and/or Pear DB to manipulate the array.

HTH
Jerry
Jul 17 '05 #3
lk******@geocit ies.com (lawrence) wrote in message
news:<da******* *************** ****@posting.go ogle.com>...

Does anyone know of any built-in search algorithms with MySql?


Yes:

http://dev.mysql.com/doc/mysql/en/Fulltext_Search.html

Cheers,
NC
Jul 17 '05 #4
lawrence wrote:
I've spent some time going over this page:

http://dev.mysql.com/doc/mysql/en/Da...ipulation.html

And so far it seems the answer is no. So I thought I'd ask here. Does
anyone know of any built-in search algorithms with MySql?

I'm looking for a way to return the results of my last SELECT
statement (which uses LIKE) based on the number of hits the LIKE came
up with. In other words, I want something like this:

SELECT * FROM mainContent WHERE mainText LIKE '%$matchThis%' ORDER BY
number of matches per entry DESC


Have you seen the full text search functions page?

http://dev.mysql.com/doc/mysql/en/Fulltext_Search.html
Jul 17 '05 #5
Jerry Gitomer <jg******@erols .com> wrote in message
I had another thought about your problem. If you have sufficient memory
available you could read the query result into an array and then use PHP
and/or Pear DB to manipulate the array.


This is exactly what I'm trying to avoid. I already have written the
PHP code to this, but it is cumbersome. I was hoping to elimnate it
and replace it with some built-in MySql function.

I do take your point about inconsistent results across RDBMS, but I
don't see that as a huge problem - merely something the end user needs
to live with when they choose their RDBMS.
Jul 17 '05 #6
nc@iname.com (Nikolai Chuvakhin) wrote in message
Does anyone know of any built-in search algorithms with MySql?


http://dev.mysql.com/doc/mysql/en/Fulltext_Search.html


Fantastic, thank you. Do you know under what conditions I can expect
to be hit worst with the slow down they warn about due to FULL TEXT
indexing? On a large site how would this be done? Should I create a
temporary table for the searches? A site serving up a large number of
web pages might grind to a slow pace if I hit too much of it with FULL
TEXT indexing. Any advice?

Also, the example they give doesn't show how to get hold of the
relevance number. They describe is as a non-negative floating point
number. If I want to show it to the user, how do I get it? I mean, if
I want to get it into my PHP code, by what index or handle to I get
it? mysql_fetch_arr ay set to MYSQL_ASSOC will return what I specify of
table fields, but the relevance is not a table field. How do I get it?
Jul 17 '05 #7

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

Similar topics

3
10049
by: fabriZio | last post by:
I run php pages in IIS in cgi-mode(only pointing them to PHP.exe). But I can't connect to database: Fatal error: Call to undefined function: mysql_pconnect()..... I read that I have to activate PHP with mySQL support...but where in my scenario?? I looked at php.ini...but no results...
0
2064
by: W i l l | last post by:
I have Apache 2 parsing and serving PHP files just fine on my winXP box, however, when I try to add some mysql database functionality I get a warning that looks like this: Fatal error: Call to undefined function mysql_connect() in D:\SITES\mysql.php on line 3 I am able to connect to mysql via the terminal just fine. Due to the error "undefined function" I wonder if I set PHP up wrong or something. Any ideas?
5
1978
by: Martin | last post by:
I don't know if this is a PHP problem or a MySQL problem - hopefully, someone here can give me a clue. I am getting the subject error when I try to connect to MySQL from a PHP page. $conn = mysql_connect( $domain, $user, $password ); I'm using PHP 5.0.1 and MySQL Server: 4.1.9; Client: 5.0.0 Running on Windows XP (IIS, of course)
0
1460
by: Henry Hank | last post by:
Environment: I'm setting up a database server on a Dell Poweredge 2650, dual 1.8GHZ pentium with 1GB of memory and RAID5 drives. I've installed RedHat 9, and updated the kernel to 2.4.20-19.9smp. I've installed the RPM binary distribution of MySQL 4.0.14 right from the MySQL website. The only thing I have done is disable InnoDb in my my.cnf file. Database Table: I have a database with 21.4 million records. One field is a VARCHAR(255)...
13
12225
by: wideangle | last post by:
Hello there! I know it's stupid, but when creating a table in a mysql (win32) database, it won't let me create this "mytable". Here goes my ER_PARSE_ERROR. mysql> CREATE TABLE `mytable` ( -> `mytable_id` int(25) NOT NULL auto_increment, -> `mytable_title` varchar(100) NOT NULL default '', -> `mytable_dts` varchar(25) NOT NULL default '',
1
1344
by: firewood | last post by:
I'm developing a PHP/MySQL site that will take images and text and automatically create a website from templates. I need a good search engine script to run separately on each of the websites that will be built using my script. (i.e. search only one website, not many). Does anyone have a recommendation for a good search engine?
113
5254
by: John Nagle | last post by:
The major complaint I have about Python is that the packages which connect it to other software components all seem to have serious problems. As long as you don't need to talk to anything outside the Python world, you're fine. But once you do, things go downhill. MySQLdb has version and platform compatibility problems. So does M2Crypto. The built-in SSL support is weak. Even basic sockets don't quite work right; the socket module...
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
6
2909
by: Cirene | last post by:
From my experience/undertanding SQL Server (and SQL Express) is the preferred db to use with Visual Studio and is very nicely integrated with it. It works well with the built in membership, etc... A collegue of mine, who only has MySQL experience, wants to use only that instead. I'm about to do a project for him and I really want to use SQL Server or Express. What are some other points that I could use to help convince him to migrate...
0
8278
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
8807
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
8701
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
8466
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
8584
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...
1
6158
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
4290
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2701
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
1912
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.