[Zope-dev] Searching a relational database

James Henstridge james@quoll.daa.com.au
Mon, 26 Jun 2000 15:53:41 +0800 (WST)


On Sat, 24 Jun 2000, Thomas Weholt wrote:

> Hi,
>  
> How can I search a relational database thru Zope? ( I`m using PostgreSQL
> 7.0.2 on Linux ). I have a DVD/VHS-organizing project that would be
> pretty useless if people couldn`t search for movies by entering just
> parts of the title. 
>  
> Ex. typing alien should show "Alien" and "Alien 3". 

If you just want to do a single search term, you could easily set up an
SQL method that read something like:
  select * from table where title like '%<dtml-sqlvar search>%'

(I hope that syntax works with MS SQL server).  It is probably possible to
get zope to escape special characters in the string for you as well.

>  
> Can ZCatalog be used for this? If I have a SQL-statement that returns
> all rows in a database, can ZCatalog index this? 

This would negate the benefits of having an SQL database (eg. indexing,
etc).  Just write an sql method that does the search.

>  
> What I`m looking for is similar to full-text searching on MS SQL 7.0
> etc.
>  
> Tips, hints or pointers??
>  
> Thomas
>  

James.