PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.databases.mysql > select * from table where match (field1, field2) against ('some search string')
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
select * from table where match (field1, field2) against ('some search string')

Réponse
 
LinkBack Outils de la discussion
Vieux 18/10/2007, 00h49   #1
Dundonald
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut select * from table where match (field1, field2) against ('some search string')

I've been looking in to the query

select * from table where match (field1, field2) against ('some search
string')

for search engine like queries. But question is, can you include
additional where's such as:

select * from table where fieldx='something' and match (field1,
field2) against ('some search string')

?

  Réponse avec citation
Vieux 18/10/2007, 00h54   #2
Rik Wasmus
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: select * from table where match (field1, field2) against ('some search string')

On Thu, 18 Oct 2007 00:49:29 +0200, Dundonald <mark.dundon@gmail.com>
wrote:

> I've been looking in to the query
>
> select * from table where match (field1, field2) against ('some search
> string')
>
> for search engine like queries. But question is, can you include
> additional where's such as:
>
> select * from table where fieldx='something' and match (field1,
> field2) against ('some search string')


Well, why not try it?
--
Rik Wasmus
  Réponse avec citation
Vieux 18/10/2007, 01h06   #3
Dundonald
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: select * from table where match (field1, field2) against ('some search string')

On Oct 17, 11:54 pm, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> On Thu, 18 Oct 2007 00:49:29 +0200, Dundonald <mark.dun...@gmail.com>
> wrote:
>
> > I've been looking in to the query

>
> > select * from table where match (field1, field2) against ('some search
> > string')

>
> > for search engine like queries. But question is, can you include
> > additional where's such as:

>
> > select * from table where fieldx='something' and match (field1,
> > field2) against ('some search string')

>
> Well, why not try it?
> --
> Rik Wasmus


Ha you know what, I thought that just as I clicked the send

Out of interest, I'm getting an error from mysql for the statement
below, yet I can't see anything wrong with it - can someone else take
a look and spot anything that I may have missed?

I'm running mysql-5.0.45-win32

In fact I think I just spotted it, '' in the match brackets ! I'll
leave this post here in case anyone else has the same prob in the
future and can learn from it.

query:

select * from givget_resources where match
('givget_resources_description' , 'givget_resources_title') against
('title')


table definition:

create table givget_resources (
givget_resources_id bigint unsigned not null auto_increment,
givget_resources_title text not null default "",
givget_resources_description text not null default "",

fulltext (givget_resources_title,
givget_resources_description),

primary key(givget_resources_id)
);

  Réponse avec citation
Vieux 18/10/2007, 01h10   #4
Rik Wasmus
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: select * from table where match (field1, field2) against ('some search string')

On Thu, 18 Oct 2007 01:06:26 +0200, Dundonald <mark.dundon@gmail.com>
wrote:

> On Oct 17, 11:54 pm, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
>> On Thu, 18 Oct 2007 00:49:29 +0200, Dundonald <mark.dun...@gmail.com>
>> wrote:
>>
>> > I've been looking in to the query

>>
>> > select * from table where match (field1, field2) against ('some search
>> > string')

>>
>> > for search engine like queries. But question is, can you include
>> > additional where's such as:

>>
>> > select * from table where fieldx='something' and match (field1,
>> > field2) against ('some search string')

>>
>> Well, why not try it?
>> --
>> Rik Wasmus

>
> Ha you know what, I thought that just as I clicked the send
>
> Out of interest, I'm getting an error from mysql for the statement
> below, yet I can't see anything wrong with it - can someone else take
> a look and spot anything that I may have missed?
>
> I'm running mysql-5.0.45-win32
>
> In fact I think I just spotted it, '' in the match brackets ! I'll
> leave this post here in case anyone else has the same prob in the
> future and can learn from it.
>
> query:
>
> select * from givget_resources where match
> ('givget_resources_description' , 'givget_resources_title') against
> ('title')


Indeed, MATCH() takes a comma-separated list that names the columns to be
searched, not strings
--
Rik Wasmus
  Réponse avec citation
Vieux 18/10/2007, 01h38   #5
Dundonald
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: select * from table where match (field1, field2) against ('some search string')

On Oct 18, 12:10 am, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> On Thu, 18 Oct 2007 01:06:26 +0200, Dundonald <mark.dun...@gmail.com>
> wrote:
>
>
>
> > On Oct 17, 11:54 pm, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> >> On Thu, 18 Oct 2007 00:49:29 +0200, Dundonald <mark.dun...@gmail.com>
> >> wrote:

>
> >> > I've been looking in to the query

>
> >> > select * from table where match (field1, field2) against ('some search
> >> > string')

>
> >> > for search engine like queries. But question is, can you include
> >> > additional where's such as:

>
> >> > select * from table where fieldx='something' and match (field1,
> >> > field2) against ('some search string')

>
> >> Well, why not try it?
> >> --
> >> Rik Wasmus

>
> > Ha you know what, I thought that just as I clicked the send

>
> > Out of interest, I'm getting an error from mysql for the statement
> > below, yet I can't see anything wrong with it - can someone else take
> > a look and spot anything that I may have missed?

>
> > I'm running mysql-5.0.45-win32

>
> > In fact I think I just spotted it, '' in the match brackets ! I'll
> > leave this post here in case anyone else has the same prob in the
> > future and can learn from it.

>
> > query:

>
> > select * from givget_resources where match
> > ('givget_resources_description' , 'givget_resources_title') against
> > ('title')

>
> Indeed, MATCH() takes a comma-separated list that names the columns to be
> searched, not strings
> --
> Rik Wasmus


)

Interestingly, check this out, I'm not sure why there are no results
being returned ... (can't you tell I'm new to using match ..
against ... !

Surely all 4 rows should be returned because 'title' occurs in all 4?

mysql> select * from givget_resources where match
(givget_resources_title,givget_resources_descripti on) against
('title');
Empty set (0.00 sec)

mysql> select * from givget_resources;
+---------------------+------------+---------------------------
+------------------------+------------------------------+
| givget_resources_id | members_id | givget_free_resource_flag |
givget_resources_title | givget_resources_description |
+---------------------+------------+---------------------------
+------------------------+------------------------------+
| 1 | 1 | y | Free
title 1 | free desc 1 |
| 2 | 1 | n |
exchange title 1 | exchange desc 1 |
| 3 | 1 | y | Free
title 2 | free desc 2 |
| 4 | 1 | n |
exchange title 2 | exchange desc 2 |
+---------------------+-----------------------
+---------------------------+------------------------
+------------------------------+

  Réponse avec citation
Vieux 18/10/2007, 01h57   #6
Rik Wasmus
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: select * from table where match (field1, field2) against ('some search string')

On Thu, 18 Oct 2007 01:38:23 +0200, Dundonald <mark.dundon@gmail.com>
wrote:
> On Oct 18, 12:10 am, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
>> On Thu, 18 Oct 2007 01:06:26 +0200, Dundonald <mark.dun...@gmail.com>
>> wrote:
>> > On Oct 17, 11:54 pm, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
>> >> On Thu, 18 Oct 2007 00:49:29 +0200, Dundonald <mark.dun...@gmail.com>
>> >> wrote:

>>
>> >> > I've been looking in to the query

>>
>> >> > select * from table where match (field1, field2) against ('some

>> search
>> >> > string')

>>
>> >> > for search engine like queries. But question is, can you include
>> >> > additional where's such as:

>>
>> >> > select * from table where fieldx='something' and match (field1,
>> >> > field2) against ('some search string')

>>
>>
>> > Ha you know what, I thought that just as I clicked the send

>>
>> > Out of interest, I'm getting an error from mysql for the statement
>> > below, yet I can't see anything wrong with it - can someone else take
>> > a look and spot anything that I may have missed?

>>
>> > I'm running mysql-5.0.45-win32

>>
>> > In fact I think I just spotted it, '' in the match brackets ! I'll
>> > leave this post here in case anyone else has the same prob in the
>> > future and can learn from it.

>>
>> > query:

>>
>> > select * from givget_resources where match
>> > ('givget_resources_description' , 'givget_resources_title') against
>> > ('title')

>>
>> Indeed, MATCH() takes a comma-separated list that names the columns to
>> be
>> searched, not strings

>
> Interestingly, check this out, I'm not sure why there are no results
> being returned ... (can't you tell I'm new to using match ..
> against ... !
>
> Surely all 4 rows should be returned because 'title' occurs in all 4?


That is not how it works. Check the manual.
Some snippet:
"A natural language search interprets the search string as a phrase in
natural human language (a phrase in free text). There are no special
operators. The stopword list applies. In addition, words that are present
in more than 50% of the rows are considered common and do not match.
Full-text searches are natural language searches if no modifier is given.. "

So stopwords aren't matched, something matching more then 50% of the rows
is considered a lousy searchterm and will not match. Pick up the manual,
and read what it sais about Full-Text searches/Match() Against syntax. The
main issue here is to grasp the difference between:
- natural language seach
- boolean mode search
- with query expansion.

--
Rik Wasmus
  Réponse avec citation
Vieux 18/10/2007, 07h44   #7
Dundonald
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: select * from table where match (field1, field2) against ('some search string')

On Oct 18, 12:10 am, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> On Thu, 18 Oct 2007 01:06:26 +0200, Dundonald <mark.dun...@gmail.com>
> wrote:
>
>
>
> > On Oct 17, 11:54 pm, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> >> On Thu, 18 Oct 2007 00:49:29 +0200, Dundonald <mark.dun...@gmail.com>
> >> wrote:

>
> >> > I've been looking in to the query

>
> >> > select * from table where match (field1, field2) against ('some search
> >> > string')

>
> >> > for search engine like queries. But question is, can you include
> >> > additional where's such as:

>
> >> > select * from table where fieldx='something' and match (field1,
> >> > field2) against ('some search string')

>
> >> Well, why not try it?
> >> --
> >> Rik Wasmus

>
> > Ha you know what, I thought that just as I clicked the send

>
> > Out of interest, I'm getting an error from mysql for the statement
> > below, yet I can't see anything wrong with it - can someone else take
> > a look and spot anything that I may have missed?

>
> > I'm running mysql-5.0.45-win32

>
> > In fact I think I just spotted it, '' in the match brackets ! I'll
> > leave this post here in case anyone else has the same prob in the
> > future and can learn from it.

>
> > query:

>
> > select * from givget_resources where match
> > ('givget_resources_description' , 'givget_resources_title') against
> > ('title')

>
> Indeed, MATCH() takes a comma-separated list that names the columns to be
> searched, not strings
> --
> Rik Wasmus




Interestingly, check this out, I'm not sure why there are no results
being returned ... (can't you tell I'm new to using match ..
against ... !


mysql> select * from givget_resources where match
(givget_resources_title,givget_resources_descripti on) against
('title');
Empty set (0.00 sec)

mysql> select * from givget_resources;
+---------------------+------------+---------------------------
+------------------------+------------------------------+
| givget_resources_id | members_id | givget_free_resource_flag |
givget_resources_title | givget_resources_description |
+---------------------+------------+---------------------------
+------------------------+------------------------------+
| 1 | 1 | y | Free
title 1 | free desc 1 |
| 2 | 1 | n |
exchange title 1 | exchange desc 1 |
| 3 | 1 | y | Free
title 2 | free desc 2 |
| 4 | 1 | n |
exchange title 2 | exchange desc 2 |
+---------------------+-----------------------
+---------------------------+------------------------
+------------------------------+

  Réponse avec citation
Vieux 18/10/2007, 08h23   #8
Dundonald
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: select * from table where match (field1, field2) against ('some search string')

On Oct 18, 12:10 am, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> On Thu, 18 Oct 2007 01:06:26 +0200, Dundonald <mark.dun...@gmail.com>
> wrote:
>
>
>
> > On Oct 17, 11:54 pm, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> >> On Thu, 18 Oct 2007 00:49:29 +0200, Dundonald <mark.dun...@gmail.com>
> >> wrote:

>
> >> > I've been looking in to the query

>
> >> > select * from table where match (field1, field2) against ('some search
> >> > string')

>
> >> > for search engine like queries. But question is, can you include
> >> > additional where's such as:

>
> >> > select * from table where fieldx='something' and match (field1,
> >> > field2) against ('some search string')

>
> >> Well, why not try it?
> >> --
> >> Rik Wasmus

>
> > Ha you know what, I thought that just as I clicked the send

>
> > Out of interest, I'm getting an error from mysql for the statement
> > below, yet I can't see anything wrong with it - can someone else take
> > a look and spot anything that I may have missed?

>
> > I'm running mysql-5.0.45-win32

>
> > In fact I think I just spotted it, '' in the match brackets ! I'll
> > leave this post here in case anyone else has the same prob in the
> > future and can learn from it.

>
> > query:

>
> > select * from givget_resources where match
> > ('givget_resources_description' , 'givget_resources_title') against
> > ('title')

>
> Indeed, MATCH() takes a comma-separated list that names the columns to be
> searched, not strings
> --
> Rik Wasmus




Interestingly, check this out, I'm not sure why there are no results
being returned ... (can't you tell I'm new to using match ..
against ... !


mysql> select * from givget_resources where match
(givget_resources_title,givget_resources_descripti on) against
('title');
Empty set (0.00 sec)

mysql> select * from givget_resources;
+---------------------+------------+---------------------------
+------------------------+------------------------------+
| givget_resources_id | members_id | givget_free_resource_flag |
givget_resources_title | givget_resources_description |
+---------------------+------------+---------------------------
+------------------------+------------------------------+
| 1 | 1 | y | Free
title 1 | free desc 1 |
| 2 | 1 | n |
exchange title 1 | exchange desc 1 |
| 3 | 1 | y | Free
title 2 | free desc 2 |
| 4 | 1 | n |
exchange title 2 | exchange desc 2 |
+---------------------+-----------------------
+---------------------------+------------------------
+------------------------------+

  Réponse avec citation
Vieux 18/10/2007, 16h18   #9
Dundonald
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: select * from table where match (field1, field2) against ('some search string')

On 17 Oct, 23:57, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> On Thu, 18 Oct 2007 01:38:23 +0200, Dundonald <mark.dun...@gmail.com>
> wrote:
>
>
>
> > On Oct 18, 12:10 am, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> >> On Thu, 18 Oct 2007 01:06:26 +0200, Dundonald <mark.dun...@gmail.com>
> >> wrote:
> >> > On Oct 17, 11:54 pm, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> >> >> On Thu, 18 Oct 2007 00:49:29 +0200, Dundonald <mark.dun...@gmail.com>
> >> >> wrote:

>
> >> >> > I've been looking in to the query

>
> >> >> > select * from table where match (field1, field2) against ('some
> >> search
> >> >> > string')

>
> >> >> > for search engine like queries. But question is, can you include
> >> >> > additional where's such as:

>
> >> >> > select * from table where fieldx='something' and match (field1,
> >> >> > field2) against ('some search string')

>
> >> > Ha you know what, I thought that just as I clicked the send

>
> >> > Out of interest, I'm getting an error from mysql for the statement
> >> > below, yet I can't see anything wrong with it - can someone else take
> >> > a look and spot anything that I may have missed?

>
> >> > I'm running mysql-5.0.45-win32

>
> >> > In fact I think I just spotted it, '' in the match brackets ! I'll
> >> > leave this post here in case anyone else has the same prob in the
> >> > future and can learn from it.

>
> >> > query:

>
> >> > select * from givget_resources where match
> >> > ('givget_resources_description' , 'givget_resources_title') against
> >> > ('title')

>
> >> Indeed, MATCH() takes a comma-separated list that names the columns to
> >> be
> >> searched, not strings

>
> > Interestingly, check this out, I'm not sure why there are no results
> > being returned ... (can't you tell I'm new to using match ..
> > against ... !

>
> > Surely all 4 rows should be returned because 'title' occurs in all 4?

>
> That is not how it works. Check the manual.
> Some snippet:
> "A natural language search interprets the search string as a phrase in
> natural human language (a phrase in free text). There are no special
> operators. The stopword list applies. In addition, words that are present
> in more than 50% of the rows are considered common and do not match.
> Full-text searches are natural language searches if no modifier is given. "
>
> So stopwords aren't matched, something matching more then 50% of the rows
> is considered a lousy searchterm and will not match. Pick up the manual,
> and read what it sais about Full-Text searches/Match() Against syntax. The
> main issue here is to grasp the difference between:
> - natural language seach
> - boolean mode search
> - with query expansion.
>
> --
> Rik Wasmus


Yep as it happened, once again after posting I read through the manual
and saw that. So I increased the number of rows in the table and it
then pulled back the search ok. Thanks Rik.

Sorry about the duplicates by the way on that last post - google
groups sent a few through!

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 01h16.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,24102 seconds with 17 queries