Simple BOOLEAN search
suggest changeSET @searchTerm= 'Database Programming -Java';
SELECT MATCH (Title) AGAINST (@searchTerm IN BOOLEAN MODE) Score,
ISBN, Author, Title
FROM book
WHERE MATCH (Title) AGAINST (@searchTerm IN BOOLEAN MODE)
ORDER BY MATCH (Title) AGAINST (@searchTerm IN BOOLEAN MODE) DESC;
Given a table named book with columns named ISBN, Title, and Author, this searches for books with the words 'Database' and 'Programming' in the title, but not the word 'Java'.
For this to work, a fulltext index on the Title column must be available:
ALTER TABLE book ADD FULLTEXT INDEX Fulltext_title_index (Title);
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents