pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Indexing Metaphone?
4+ messages / 3 participants
[nested] [flat]

* Indexing Metaphone?
@ 2002-06-05 18:12 Josh Berkus <josh@agliodbs.com>
  2002-06-05 18:39 ` Re: Indexing Metaphone? Richard Poole <rp@guests.deus.net>
  2002-06-05 19:15 ` Re: Indexing Metaphone? Stephan Szabo <sszabo@megazone23.bigpanda.com>
  0 siblings, 2 replies; 4+ messages in thread

From: Josh Berkus @ 2002-06-05 18:12 UTC (permalink / raw)
  To: pgsql-sql

Folks,

I'm building a database that does a lot of fuzzy-string searches.  As such, 
I'd like to index the metaphone results of certain columns.  However, I get 
this when I try:

jwnet=> CREATE INDEX idx_locations_metaphone ON 
locations(metaphone(location_name, 12));
ERROR:  parser: parse error at or near "12"
jwnet=>

is this a syntax error, or do I need to create a column to hold the metaphone 
values in order to index them?

-- 
-Josh Berkus




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Indexing Metaphone?
  2002-06-05 18:12 Indexing Metaphone? Josh Berkus <josh@agliodbs.com>
@ 2002-06-05 18:39 ` Richard Poole <rp@guests.deus.net>
  2002-06-05 18:53   ` Re: Indexing Metaphone? Josh Berkus <josh@agliodbs.com>
  1 sibling, 1 reply; 4+ messages in thread

From: Richard Poole @ 2002-06-05 18:39 UTC (permalink / raw)
  To: pgsql-sql

On Wed, Jun 05, 2002 at 11:12:02AM -0700, Josh Berkus wrote:

> jwnet=> CREATE INDEX idx_locations_metaphone ON 
> locations(metaphone(location_name, 12));
> ERROR:  parser: parse error at or near "12"
> jwnet=>
> 
> is this a syntax error, or do I need to create a column to hold the metaphone 
> values in order to index them?

That's the error message you'd get if pg just didn't know of any
function called "metaphone". Have you done the appropriate CREATE
FUNCTION magic? "\df metaphone" in psql will tell you whether it's
heard of it or not.

Richard



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Indexing Metaphone?
  2002-06-05 18:12 Indexing Metaphone? Josh Berkus <josh@agliodbs.com>
  2002-06-05 18:39 ` Re: Indexing Metaphone? Richard Poole <rp@guests.deus.net>
@ 2002-06-05 18:53   ` Josh Berkus <josh@agliodbs.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Josh Berkus @ 2002-06-05 18:53 UTC (permalink / raw)
  To: Richard Poole <rp@guests.deus.net>; pgsql-sql


Richard,

> That's the error message you'd get if pg just didn't know of any
> function called "metaphone". Have you done the appropriate CREATE
> FUNCTION magic? "\df metaphone" in psql will tell you whether it's
> heard of it or not.

Yup:

jwnet=> \df metaphone
                 List of functions
 Result data type |   Name    | Argument data types
------------------+-----------+---------------------
 text             | metaphone | text, integer
(1 row)

-- 
-Josh Berkus




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Indexing Metaphone?
  2002-06-05 18:12 Indexing Metaphone? Josh Berkus <josh@agliodbs.com>
@ 2002-06-05 19:15 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
  1 sibling, 0 replies; 4+ messages in thread

From: Stephan Szabo @ 2002-06-05 19:15 UTC (permalink / raw)
  To: Josh Berkus <josh@agliodbs.com>; +Cc: pgsql-sql

On Wed, 5 Jun 2002, Josh Berkus wrote:

> Folks,
>
> I'm building a database that does a lot of fuzzy-string searches.  As such,
> I'd like to index the metaphone results of certain columns.  However, I get
> this when I try:
>
> jwnet=> CREATE INDEX idx_locations_metaphone ON
> locations(metaphone(location_name, 12));
> ERROR:  parser: parse error at or near "12"

Functional indexes only take columns as arguments IIRC.  Make
a cachable function that returns metaphone($1, 12) given the
appropriate type and index/use that. :)




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2002-06-05 19:15 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-06-05 18:12 Indexing Metaphone? Josh Berkus <josh@agliodbs.com>
2002-06-05 18:39 ` Richard Poole <rp@guests.deus.net>
2002-06-05 18:53   ` Josh Berkus <josh@agliodbs.com>
2002-06-05 19:15 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>

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