Using INDEX in WHERE CLAUSE (database search)

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Using INDEX in WHERE CLAUSE (database search)

Post by kendall »

Hello,

Im have a table in which i have a FULLTEXT search ON (Title, Description) so that i can have these to colmuns indexed for searching the database

[quote]
My question is can i use the 'search' index name in a WHERE CLAUSE when querying search terms?
[/quote]

e.g.

[syntax=php]SELECT ID, Title, Description, Clicks, MATCH (Title, Description) AGAINST ('hotel, rooms, accomodations, guest') AS Score FROM online_directory WHERE INDEX(search) MATCH (Title,Description) AGAINST ('hotel, rooms, guest, accomodations') ORDER BY score DESC;[/syntax] P.S please excuse the code im just trying to explain my self in terms of coding :oops:

Kendall
User avatar
Stoker
Forum Regular
Posts: 782
Joined: Thu Jan 23, 2003 9:45 pm
Location: SWNY
Contact:

Post by Stoker »

You don't specify search on index, the RDBMS will take care of that for you, all indexes are transparent to any SELECT query (unless you use VERBOSE EXPLAIN or similar for debugging)..

You design your indexes to fit your queries..
Post Reply