Re: Does MySql have any built in search functionality
From: Jerry Gitomer (jgitomer_at_erols.com)
Date: 04/30/04
- Next message: Ben Wilson: "Re: anchors"
- Previous message: Mike Andrews: "NEWBIE: PHP login security"
- In reply to: Jerry Gitomer: "Re: Does MySql have any built in search functionality"
- Next in thread: Nikolai Chuvakhin: "Re: Does MySql have any built in search functionality"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 30 Apr 2004 09:25:34 -0400
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/Data_Manipulation.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
- Next message: Ben Wilson: "Re: anchors"
- Previous message: Mike Andrews: "NEWBIE: PHP login security"
- In reply to: Jerry Gitomer: "Re: Does MySql have any built in search functionality"
- Next in thread: Nikolai Chuvakhin: "Re: Does MySql have any built in search functionality"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|