|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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') ? |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
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) ); |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
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 | +---------------------+----------------------- +---------------------------+------------------------ +------------------------------+ |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
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 | +---------------------+----------------------- +---------------------------+------------------------ +------------------------------+ |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
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 | +---------------------+----------------------- +---------------------------+------------------------ +------------------------------+ |
|
|
|
#9 |
|
Messages: n/a
Hébergeur: |
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! |
|
![]() |
| Outils de la discussion | |
|
|