473,508 Members | 2,441 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 1573
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******@geocities.com (lawrence) wrote in message
news:<da**************************@posting.google. 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_array 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
10040
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...
0
2057
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...
5
1974
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 =...
0
1454
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....
13
12204
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` ( ->...
1
1341
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...
113
5184
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...
6
3517
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
2901
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......
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7488
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...
0
5623
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,...
1
5045
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...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1544
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 ...
1
762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
412
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.