[Koha-devel] query optimization

Chris Cormack chris at katipo.co.nz
Tue May 14 02:42:03 CEST 2002


On Tue, 2002-05-14 at 21:28, paul POULAIN wrote:
> Many queries are build with :
> 
> (title like '$key[0]%' or title like '% $key[0]%')
> 
> I was wondering why :
> * title like '$key%' is index optimizable
> * title like '% $key%' is NOT index optimizable.
> 
> optimizable OR not optimizable === NOT optimizable.
> 
> So the resulting query is not optimizable.
> 
> So, what's the interest of such a string, as "title like '%'.$key.'%'" 
> has the same result ?

If title like '%'.$key.'%'" does the same thing and is optimisable then
we should use that.
What the above is trying to do is find the word if its at the start of
the title, or is another word thats part of the title.
For eg if we are searching for 'host'
we want it to find titles such as 'Host of stuff' and 'Here come the
hosts'

We dont want to find 'ghosts'  Ie we only want wildcarding off the end
of each word. Not the front.

I hope this makes sense.

If your above construct can do this, that would be great :)

Chris
-- 
Chris Cormack                                      chris at katipo.co.nz
Programmer                                                025 500 579
Katipo Communications                                www.katipo.co.nz




More information about the Koha-devel mailing list