pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Louis-David Mitterrand <vindex+lists-pgsql-sql@apartia.org>
To: sql pgsql <pgsql-sql@postgresql.org>
Subject: Re: simple web search
Date: Fri, 23 Feb 2007 19:07:57 +0100
Message-ID: <20070223180757.GA22649@apartia.fr> (raw)
In-Reply-To: <784381.72635.qm@web54306.mail.yahoo.com>
References: <20070223162731.GA25577@apartia.fr>
	<784381.72635.qm@web54306.mail.yahoo.com>

On Fri, Feb 23, 2007 at 10:01:22AM -0800, chester c young wrote:
> > I'm considering implementing a search box on my review web site 
> > http://lesculturelles.net and am looking for a simple way to match 
> > entered words against several columns on related tables:
> > show.show_name, story.title, person.firtname, person.lastname, etc.
> 
> one solution would be a view:
> 
> create view search_v as select
>   'show'::name as tab_nm,
>   show_id as tab_pk,
>   'Show Name' as description,
>   show_name as search
>   from show
> union select
>   'story'::name,
>   story_id,
>   'Story Title',
>   title
>   from story
> union ...
> 
> your query would be
>   select * from search_v where '$string' ilike search
> 
> this would return a list the user could use to drill down further.

Thanks, this looks promising. The union and view ideas are indeed 
inspiring. 

What is that ::name cast for?



view thread (8+ messages)  latest in thread

Message-ID: <20070223180757.GA22649@apartia.fr>
Permalink:  ../20070223180757.GA22649@apartia.fr/
Also on:    postgresql.org/message-id/20070223180757.GA22649@apartia.fr

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: vindex+lists-pgsql-sql@apartia.org
  Subject: Re: simple web search
  In-Reply-To: <20070223180757.GA22649@apartia.fr>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox