I have a table of Australian postcodes and address. There are 15k rows with each row looking like this:
Code:
postcode | suburb | state
2048 | Westgate | NSW
2066 | Blah | NSW
Triggered by a text input field with jQuery autocomplete, I'm running a search on the suburb and postcode using this code
Code:
SELECT address_id as id, CONCAT(suburb,' ',state,' ',postcode) as value FROM address WHERE address_id != ''";
foreach ($keywords as $keyword)
{
$query .= " AND (postcode like '".$keyword."%' OR suburb like '%".$keyword."%')";
}
Is that the most efficient way to do it? or should I be considering full text searching?
The above does basically work, I'm just not sure if it's the best practice.