SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Feb 2010
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Newbie: This MATCH() AGAINST() returns nothing. Why?

    I am just starting out with fulltext searches, but every attemt so far has failed, although it seems the tutorial I am following says what I am doing should be working. I am on mysql 5.0, this is a query I am trying to run:

    Code:
    CREATE TABLE  myTable (
    	id INT( 5 ) NOT NULL ,
    	tid INT( 15 ) NOT NULL ,
    	author VARCHAR( 100 ) NOT NULL ,
    	title VARCHAR( 150 ) NOT NULL ,
    	introduction VARCHAR( 255 ) NOT NULL ,
    	body TEXT NOT NULL ,
    	tags VARCHAR( 100 ) NOT NULL
    ) ENGINE = MYISAM ;
    
    INSERT INTO myTable (
    	`id`, 
    	`tid`, 
    	`author`, 
    	`title`, 
    	`introduction`, 
    	`body`, 
    	`tags`
    ) VALUES (
    	1000, 
    	1273150110, 
    	'Rachel', 
    	'This is a great heading', 
    	'Lorem ipsum dolor sit amet', 
    	'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas at augue eu tortor elementum condimentum. Proin adipiscing adipiscing odio ac ornare. Pellentesque nec adipiscing elit. Nunc egestas magna purus, id venenatis nulla. Integer faucibus, urna eget sollicitudin ornare, urna ligula semper ipsum, ut luctus sapien quam eu est. Donec tincidunt placerat ipsum, tristique condimentum nulla luctus sed. Maecenas gravida semper lectus, vitae imperdiet mauris ullamcorper in. Vestibulum sit amet sagittis mauris. In quis nibh velit.', 
    	'Tag');
    
    INSERT INTO myTable (
    	`id`, 
    	`tid`, 
    	`author`, 
    	`title`, 
    	`introduction`, 
    	`body`, 
    	`tags`
    ) VALUES (
    	1001, 
    	1273150310, 
    	'Maximus', 
    	'Hello World', 
    	'This is an informative heading', 
    	'Quisque ligula lorem, rutrum a eleifend ac, adipiscing a risus. Nunc feugiat, lacus sed accumsan semper, justo neque dapibus augue, non pellentesque libero massa vitae mauris. Donec rutrum lectus nec ante placerat congue varius mi pulvinar. Nunc rhoncus molestie dui et scelerisque. Etiam sodales venenatis viverra. Morbi accumsan iaculis ante ac sagittis. Suspendisse aliquam ipsum ut eros vulputate quis adipiscing turpis tincidunt.', 
    	'Tag,Info'
    );
    
    ALTER TABLE myTable ADD FULLTEXT(body, title, introduction);
    
    SELECT * FROM myTable WHERE MATCH(title, introduction, body) AGAINST('donec');
    Question 1: Why does it return empty result?
    Question 2: If I in the future want to add rows to this table, to I have to ADD FULLTEXT to that information, or will the information be indexed automatically for all future rows?

    Thank you for your time.

    Kind regards,
    Marius

  2. #2
    SitePoint Wizard guelphdad's Avatar
    Join Date
    Oct 2003
    Location
    St. Catharines, ON Canada
    Posts
    1,708
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you don't have enough data in your table. Any query on full text that would return 50% or more of the rows is ignored.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •