[OSM-dev] Namefinder - what to do

Tom Hughes tom at compton.nu
Wed Jan 23 00:09:59 GMT 2008


On 22/01/2008, Robert (Jamie) Munro <rjmunro at arjam.net> wrote:

> |> TomH: what do you think about creating a full text index on  way_tags
> k & v?
> |
> | We already have one on v, but not k.
> |
> | I've no objection to putting one on k - it will allow some more
> | restrictions on the search API to be lifted.
>
> Surely k only needs a normal index, not a full text one. For the
> purposes of a name finder like thing we just need to search the values
> for k=name - I don't know if you can do a conditional index in MySQL. I
> have a feeling you can't, which means that it would have to be a
> separate table of name tag values.

The problem is that you normally want to search for a combination of
key and value and you can't do that with ordinary indexes in MySQL as
it will only ever read on one index (obviously if you index on k+v you
could, but only for exact values).

If you create a full text index on both fields, then you can do a
fulltext query to narrow down the records, then exact match those to
find the ones you really want.

Tom

-- 
Tom Hughes (tom at compton.nu)
http://www.compton.nu/




More information about the dev mailing list