Computer Webmaster Gaming Console Graphics Forum

Welcome to the Computer Webmaster Gaming Console Graphics Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

MK PitStop Main Earn $25 Earn Money Posting Extras Members Blogs Image Hosting User Pages
Go Back   Computer Webmaster Gaming Console Graphics Forum > Webmaster Forum > Website Coding > Database
Register FAQ/Rules Become A V.I.P. Member Search Today's Posts Mark Forums Read

Database Database problems or need to ask a question? maybe something to do with sql injections or a database software question. Database topics cover MySQL, PostgreSQL, Oracle, SQL Server or anything else related to databases.

Google
Reply
 
LinkBack Thread Tools Display Modes
Old 07-02-2007, 11:00 AM   #1
korcs
 
korcs's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default FULLTEXT Search Problem

Hi All,

i have a little problem with my FULLTEXT search.

My TABLE structure is:

CREATE TABLE `static_pages` (
`id` int(11) NOT NULL auto_increment,
`title` varchar(255) default NULL,
`parentId` int(11) default NULL,
`priority` int(11) NOT NULL default '0',
`isStatic` tinyint(1) NOT NULL default '0',
`path` varchar(255) NOT NULL default '',
`category_id` int(11) default NULL,
`sector_id` int(11) default NULL,
`content` text NOT NULL,
`isActive` tinyint(4) NOT NULL default '0',
`rubrik` text,
`meta_title` varchar(255) default NULL,
`meta_description` text,
`meta_keywords` text,
`notice` text,
`contact_person` varchar(255) default NULL,
`created` datetime default NULL,
`modified` datetime default NULL,
`addedBy` int(11) NOT NULL default '0',
`editedBy` int(11) NOT NULL default '0',
`lastChange` timestamp NULL default NULL,
PRIMARY KEY (`id`),
FULLTEXT KEY `title` (`title`),
FULLTEXT KEY `content` (`content`)
) TYPE=MyISAM AUTO_INCREMENT=190 ;

So I have 2 Fields indexed for FULLTEXT Search.

I have experienced that my search function does not find all the
entries, that actually match the search.
(I know that some rtoo common and short words are ignored when
indexing, but I think the word 'seminar' is f.e. not that common).

The cardinality of the 2 FULLTEXT indexes is 1, which makes me
worried, but I am not sure, wether this is a problem or not.


The query that I use is:

SELECT
id AS id, title AS title, '' AS extra, content AS description,
MATCH (title) AGAINST ('seminar' IN BOOLEAN MODE)
+ MATCH (content) AGAINST ('seminar' IN BOOLEAN MODE) AS rating,
'static_pages' AS table_name
FROM static_pages
WHERE (sector_id IN ('1', '2') AND category_id IN ('45', '36') )
AND (isActive = 1)
AND (MATCH (title) AGAINST ('seminar' IN BOOLEAN MODE) OR (MATCH
(content) AGAINST ('seminar' IN BOOLEAN MODE))


If I search with %LIKE% in the field 'content', I get 9 results, but
with the FULLTEXT search only 1.
(The sector_id, category_id and isActive fields are not the reason for
this phenomen - I tried...)


Hopefully somebody has a clue.

Best,

korcs

 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Reply With Quote
Advertisements
Old 07-02-2007, 11:00 AM   #2
Josselin
 
Josselin's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default FULLTEXT Search Problem

I am using the same MATCH as you , one on each column.. but my index
is setup with

ALTER TABLE proposals ADD FULLTEXT proposal_fulltext(title,
description) (I did it after table creation)

MATCH (proposal.title) AGAINST ('seminar' IN BOOLEAN MODE) OR MATCH
(proposal. description) AGAINST ('seminar' IN BOOLEAN MODE)

dont know if it can help

joss

On 2007-06-28 11:52:52 +0200, korcs <konrad.lindner@gmx.net> said:

> Hi All,
>
> i have a little problem with my FULLTEXT search.
>
> My TABLE structure is:
>
> CREATE TABLE `static_pages` (
> `id` int(11) NOT NULL auto_increment,
> `title` varchar(255) default NULL,
> `parentId` int(11) default NULL,
> `priority` int(11) NOT NULL default '0',
> `isStatic` tinyint(1) NOT NULL default '0',
> `path` varchar(255) NOT NULL default '',
> `category_id` int(11) default NULL,
> `sector_id` int(11) default NULL,
> `content` text NOT NULL,
> `isActive` tinyint(4) NOT NULL default '0',
> `rubrik` text,
> `meta_title` varchar(255) default NULL,
> `meta_description` text,
> `meta_keywords` text,
> `notice` text,
> `contact_person` varchar(255) default NULL,
> `created` datetime default NULL,
> `modified` datetime default NULL,
> `addedBy` int(11) NOT NULL default '0',
> `editedBy` int(11) NOT NULL default '0',
> `lastChange` timestamp NULL default NULL,
> PRIMARY KEY (`id`),
> FULLTEXT KEY `title` (`title`),
> FULLTEXT KEY `content` (`content`)
> ) TYPE=MyISAM AUTO_INCREMENT=190 ;
>
> So I have 2 Fields indexed for FULLTEXT Search.
>
> I have experienced that my search function does not find all the
> entries, that actually match the search.
> (I know that some rtoo common and short words are ignored when
> indexing, but I think the word 'seminar' is f.e. not that common).
>
> The cardinality of the 2 FULLTEXT indexes is 1, which makes me
> worried, but I am not sure, wether this is a problem or not.
>
>
> The query that I use is:
>
> SELECT
> id AS id, title AS title, '' AS extra, content AS description,
> MATCH (title) AGAINST ('seminar' IN BOOLEAN MODE)
> + MATCH (content) AGAINST ('seminar' IN BOOLEAN MODE) AS rating,
> 'static_pages' AS table_name
> FROM static_pages
> WHERE (sector_id IN ('1', '2') AND category_id IN ('45', '36') )
> AND (isActive = 1)
> AND (MATCH (title) AGAINST ('seminar' IN BOOLEAN MODE) OR (MATCH
> (content) AGAINST ('seminar' IN BOOLEAN MODE))
>
>
> If I search with %LIKE% in the field 'content', I get 9 results, but
> with the FULLTEXT search only 1.
> (The sector_id, category_id and isActive fields are not the reason for
> this phenomen - I tried...)
>
>
> Hopefully somebody has a clue.
>
> Best,
>
> korcs



 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Reply With Quote
Old 07-02-2007, 11:00 AM   #3
korcs
 
korcs's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default FULLTEXT Search Problem

Thanks Joss,

it seems not really helping in my case...

Best,

korcs

 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Reply With Quote
Old 07-02-2007, 11:00 AM   #4
lark
 
lark's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default FULLTEXT Search Problem

== Quote from korcs (konrad.lindner@gmx.net)'s article
> Hi All,
> i have a little problem with my FULLTEXT search.
> My TABLE structure is:
> CREATE TABLE `static_pages` (
> `id` int(11) NOT NULL auto_increment,
> `title` varchar(255) default NULL,
> `parentId` int(11) default NULL,
> `priority` int(11) NOT NULL default '0',
> `isStatic` tinyint(1) NOT NULL default '0',
> `path` varchar(255) NOT NULL default '',
> `category_id` int(11) default NULL,
> `sector_id` int(11) default NULL,
> `content` text NOT NULL,
> `isActive` tinyint(4) NOT NULL default '0',
> `rubrik` text,
> `meta_title` varchar(255) default NULL,
> `meta_description` text,
> `meta_keywords` text,
> `notice` text,
> `contact_person` varchar(255) default NULL,
> `created` datetime default NULL,
> `modified` datetime default NULL,
> `addedBy` int(11) NOT NULL default '0',
> `editedBy` int(11) NOT NULL default '0',
> `lastChange` timestamp NULL default NULL,
> PRIMARY KEY (`id`),
> FULLTEXT KEY `title` (`title`),
> FULLTEXT KEY `content` (`content`)
> ) TYPE=MyISAM AUTO_INCREMENT=190 ;
> So I have 2 Fields indexed for FULLTEXT Search.
> I have experienced that my search function does not find all the
> entries, that actually match the search.
> (I know that some rtoo common and short words are ignored when
> indexing, but I think the word 'seminar' is f.e. not that common).
> The cardinality of the 2 FULLTEXT indexes is 1, which makes me
> worried, but I am not sure, wether this is a problem or not.
> The query that I use is:
> SELECT
> id AS id, title AS title, '' AS extra, content AS description,
> MATCH (title) AGAINST ('seminar' IN BOOLEAN MODE)
> + MATCH (content) AGAINST ('seminar' IN BOOLEAN MODE) AS rating,
> 'static_pages' AS table_name
> FROM static_pages
> WHERE (sector_id IN ('1', '2') AND category_id IN ('45', '36') )
> AND (isActive = 1)
> AND (MATCH (title) AGAINST ('seminar' IN BOOLEAN MODE) OR (MATCH
> (content) AGAINST ('seminar' IN BOOLEAN MODE))
> If I search with %LIKE% in the field 'content', I get 9 results, but
> with the FULLTEXT search only 1.
> (The sector_id, category_id and isActive fields are not the reason for
> this phenomen - I tried...)
> Hopefully somebody has a clue.
> Best,
> korcs


i don't think you need the match/against statement in the body of the select
statement. it is enough to have them in the predicate only. you can refer to the
column name in the body of select:

select
id as id,
content as description,
title as rating
from
static_pages
where
blah blah
and
match (title, content) against ('+seminary' in boolean mode)

--
POST BY: lark with PHP News Reader
 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Reply With Quote
Old 07-02-2007, 11:00 AM   #5
korcs
 
korcs's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default FULLTEXT Search Problem

> select
> id as id,
> content as description,
> title as rating
> from
> static_pages
> where
> blah blah
> and
> match (title, content) against ('+seminary' in boolean mode)
>
> --
> POST BY: lark with PHP News Reader


Thanks lark!

Ok, but I need the result of the MATCH AGAINST, because I make an
ORDER BY 'rating' at the end.

Anyway, unfortunatelly it does not make any difference, whether I
write it in the body or not, the result is the same...

 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Reply With Quote
Featured Websites
Free Space
Free Space
Free Space Free Space
Reply
Tags: , ,




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
2 or more tables with FULLTEXT index saavedrajj Database 1 07-01-2007 11:01 PM
Tune performance of fulltext search jens.bertheau@gmx.de Database 3 07-01-2007 7:00 PM
FULLTEXT search - getting part of a line Roland Tanner Database 1 06-10-2007 12:26 AM
Fulltext search "LIKE" operator Morten Database 0 06-10-2007 12:22 AM
replicatable Folder Search problem : is source of problem Windows Desktop Search ? Bill Woodruff MSN questions 0 05-28-2007 1:45 AM


Featured Websites




All times are GMT +1. The time now is 4:10 AM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.0.0
Cheap Computers
MK PitStop Copyright 2005 - 2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98