![]() |
|
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. |
| |||||||
| 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. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| 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 | |||
|
| Advertisements |
| | #2 | ||
| 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 | |||
|
| | #4 | ||
| == 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 | |||
|
| | #5 | ||
| > 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... | |||
|
| Featured Websites | ||||
|
![]() |
| Tags: fulltext, problem, search |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
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 | ||||
|