head	1.5;
access;
symbols
	REL7_4_29:1.1
	REL8_0_25:1.2
	REL8_1_21:1.3
	REL8_2_17:1.4
	REL7_4_28:1.1
	REL8_0_24:1.2
	REL8_1_20:1.3
	REL8_2_16:1.4
	REL7_4_27:1.1
	REL8_0_23:1.2
	REL8_1_19:1.3
	REL8_2_15:1.4
	REL7_4_26:1.1
	REL8_0_22:1.2
	REL8_1_18:1.3
	REL8_2_14:1.4
	REL7_4_25:1.1
	REL8_0_21:1.2
	REL8_1_17:1.3
	REL8_2_13:1.4
	REL7_4_24:1.1
	REL8_0_20:1.2
	REL8_1_16:1.3
	REL8_2_12:1.4
	REL7_4_23:1.1
	REL8_0_19:1.2
	REL8_1_15:1.3
	REL8_2_11:1.4
	REL7_4_22:1.1
	REL8_0_18:1.2
	REL8_1_14:1.3
	REL8_2_10:1.4
	REL7_4_21:1.1
	REL8_0_17:1.2
	REL8_1_13:1.3
	REL8_2_9:1.4
	REL7_4_20:1.1
	REL8_0_16:1.2
	REL8_1_12:1.3
	REL8_2_8:1.4
	REL8_2_7:1.4
	REL7_3_21:1.1
	REL7_4_19:1.1
	REL8_0_15:1.2
	REL8_1_11:1.3
	REL8_2_6:1.4
	REL8_3_BETA2:1.4
	REL8_3_BETA1:1.4
	REL7_3_20:1.1
	REL7_4_18:1.1
	REL8_0_14:1.2
	REL8_1_10:1.3
	REL8_2_5:1.4
	REL7_3_19:1.1
	REL7_4_17:1.1
	REL8_0_13:1.2
	REL8_1_9:1.3
	REL8_2_4:1.4
	REL8_0_12:1.2
	REL8_1_8:1.3
	REL8_2_3:1.4
	REL7_3_18:1.1
	REL7_4_16:1.1
	REL8_0_11:1.2
	REL8_1_7:1.3
	REL8_2_2:1.4
	REL8_0_10:1.2
	REL8_1_6:1.3
	REL8_2_1:1.4
	REL7_4_15:1.1
	REL7_3_17:1.1
	REL8_2_STABLE:1.4.0.2
	REL8_2_0:1.4
	REL8_2_RC1:1.4
	REL8_2_BETA3:1.4
	REL8_2_BETA2:1.4
	REL8_1_5:1.3
	REL8_0_9:1.2
	REL7_4_14:1.1
	REL7_3_16:1.1
	REL8_2_BETA1:1.4
	REL7_3_15:1.1
	REL7_4_13:1.1
	REL8_0_8:1.2
	REL8_1_4:1.3
	REL7_3_14:1.1
	REL7_4_12:1.1
	REL8_0_7:1.2
	REL8_1_3:1.3
	REL7_3_13:1.1
	REL7_4_11:1.1
	REL8_0_6:1.2
	REL8_1_2:1.3
	REL7_3_12:1.1
	REL7_4_10:1.1
	REL8_0_5:1.2
	REL8_1_1:1.3
	REL8_1_STABLE:1.3.0.2
	REL8_1_0:1.3
	REL8_1_0RC1:1.3
	REL8_1_0BETA4:1.3
	REL8_1_0BETA3:1.3
	REL7_3_11:1.1
	REL7_4_9:1.1
	REL8_0_4:1.2
	REL8_1_0BETA2:1.3
	REL8_1_0BETA1:1.3
	REL7_2_8:1.1
	REL7_3_10:1.1
	REL7_4_8:1.1
	REL8_0_3:1.2
	REL8_0_2:1.2
	REL7_2_7:1.1
	REL7_3_9:1.1
	REL7_4_7:1.1
	REL8_0_1:1.2
	REL8_0_STABLE:1.2.0.4
	REL8_0_0:1.2.0.2
	REL8_0_0RC5:1.2
	REL8_0_0RC4:1.2
	REL8_0_0RC3:1.2
	REL8_0_0RC2:1.2
	REL8_0_0RC1:1.2
	REL8_0_0BETA5:1.2
	REL8_0_0BETA4:1.2
	REL7_4_6:1.1
	REL7_3_8:1.1
	REL7_2_6:1.1
	REL8_0_0BETA3:1.2
	REL8_0_0BETA2:1.2
	REL7_2_5:1.1
	REL7_4_5:1.1
	REL7_3_7:1.1
	REL7_4_4:1.1
	REL8_0_0BETA1:1.2
	REL7_4_3:1.1
	REL7_4_2:1.1
	REL7_3_6:1.1
	REL7_4_1:1.1
	REL7_3_5:1.1
	REL7_4:1.1
	REL7_4_RC2:1.1
	REL7_4_STABLE:1.1.0.8
	REL7_4_RC1:1.1
	REL7_4_BETA5:1.1
	REL7_4_BETA4:1.1
	REL7_4_BETA3:1.1
	REL7_4_BETA2:1.1
	WIN32_DEV:1.1.0.6
	REL7_4_BETA1:1.1
	REL7_3_4:1.1
	REL7_3_2:1.1
	REL7_2_4:1.1
	REL7_3_STABLE:1.1.0.4
	REL7_2_3:1.1
	REL7_2_STABLE:1.1.0.2
	REL7_2:1.1
	REL7_2_RC2:1.1
	REL7_2_RC1:1.1
	REL7_2_BETA5:1.1
	REL7_2_BETA4:1.1
	REL7_2_BETA3:1.1
	REL7_2_BETA2:1.1
	REL7_2_BETA1:1.1;
locks; strict;
comment	@# @;


1.5
date	2007.11.10.23.30.45;	author momjian;	state dead;
branches;
next	1.4;

1.4
date	2006.02.27.16.09.48;	author petere;	state Exp;
branches;
next	1.3;

1.3
date	2005.01.26.08.04.04;	author neilc;	state Exp;
branches;
next	1.2;

1.2
date	2004.07.01.03.25.48;	author joe;	state Exp;
branches;
next	1.1;

1.1
date	2001.08.07.18.16.01;	author momjian;	state Exp;
branches;
next	;


desc
@@


1.5
log
@Move most /contrib README files into SGML.  Some still need conversion
or will never be converted.
@
text
@NOTE: Modified August 07, 2001 by Joe Conway. Updated for accuracy
	after combining soundex code into the fuzzystrmatch contrib
---------------------------------------------------------------------
The Soundex system is a method of matching similar sounding names
(or any words) to the same code.  It was initially used by the
United States Census in 1880, 1900, and 1910, but it has little use
beyond English names (or the English pronunciation of names), and
it is not a linguistic tool.

When comparing two soundex values to determine similarity, the
difference function reports how close the match is on a scale
from zero to four, with zero being no match and four being an
exact match.

The following are some usage examples:

SELECT soundex('hello world!');

SELECT soundex('Anne'), soundex('Ann'), difference('Anne', 'Ann');
SELECT soundex('Anne'), soundex('Andrew'), difference('Anne', 'Andrew');
SELECT soundex('Anne'), soundex('Margaret'), difference('Anne', 'Margaret');

CREATE TABLE s (nm text);

INSERT INTO s VALUES ('john');
INSERT INTO s VALUES ('joan');
INSERT INTO s VALUES ('wobbly');
INSERT INTO s VALUES ('jack');

SELECT * FROM s WHERE soundex(nm) = soundex('john');

SELECT a.nm, b.nm FROM s a, s b WHERE soundex(a.nm) = soundex(b.nm) AND a.oid <> b.oid;

CREATE FUNCTION text_sx_eq(text, text) RETURNS boolean AS
'select soundex($1) = soundex($2)'
LANGUAGE SQL;

CREATE FUNCTION text_sx_lt(text, text) RETURNS boolean AS
'select soundex($1) < soundex($2)'
LANGUAGE SQL;

CREATE FUNCTION text_sx_gt(text, text) RETURNS boolean AS
'select soundex($1) > soundex($2)'
LANGUAGE SQL;

CREATE FUNCTION text_sx_le(text, text) RETURNS boolean AS
'select soundex($1) <= soundex($2)'
LANGUAGE SQL;

CREATE FUNCTION text_sx_ge(text, text) RETURNS boolean AS
'select soundex($1) >= soundex($2)'
LANGUAGE SQL;

CREATE FUNCTION text_sx_ne(text, text) RETURNS boolean AS
'select soundex($1) <> soundex($2)'
LANGUAGE SQL;

DROP OPERATOR #= (text, text);

CREATE OPERATOR #= (leftarg=text, rightarg=text, procedure=text_sx_eq, commutator = #=);

SELECT * FROM s WHERE text_sx_eq(nm, 'john');

SELECT * FROM s WHERE s.nm #= 'john';

SELECT * FROM s WHERE difference(s.nm, 'john') > 2;
@


1.4
log
@Clean up CREATE FUNCTION syntax usage in contrib and elsewhere, in
particular get rid of single quotes around language names and old WITH ()
construct.
@
text
@@


1.3
log
@The attached patch implements the soundex difference function which
compares two strings' soundex values for similarity, from Kris Jurka.
Also mark the text_soundex() function as STRICT, to avoid crashing
on NULL input.
@
text
@d23 1
a23 1
CREATE TABLE s (nm text)\g
d25 4
a28 4
insert into s values ('john')\g
insert into s values ('joan')\g
insert into s values ('wobbly')\g
insert into s values ('jack')\g
d30 1
a30 2
select * from s
where soundex(nm) = soundex('john')\g
d32 1
a32 3
select a.nm, b.nm from s a, s b
where soundex(a.nm) = soundex(b.nm)
and a.oid <> b.oid\g
d34 1
a34 1
CREATE FUNCTION text_sx_eq(text, text) RETURNS bool AS
d36 1
a36 1
LANGUAGE 'sql'\g
d38 1
a38 1
CREATE FUNCTION text_sx_lt(text,text) RETURNS bool AS
d40 1
a40 1
LANGUAGE 'sql'\g
d42 1
a42 1
CREATE FUNCTION text_sx_gt(text,text) RETURNS bool AS
d44 1
a44 1
LANGUAGE 'sql';
d46 1
a46 1
CREATE FUNCTION text_sx_le(text,text) RETURNS bool AS
d48 1
a48 1
LANGUAGE 'sql';
d50 1
a50 1
CREATE FUNCTION text_sx_ge(text,text) RETURNS bool AS
d52 1
a52 1
LANGUAGE 'sql';
d54 1
a54 1
CREATE FUNCTION text_sx_ne(text,text) RETURNS bool AS
d56 1
a56 1
LANGUAGE 'sql';
d58 1
a58 1
DROP OPERATOR #= (text,text)\g
d60 1
a60 2
CREATE OPERATOR #= (leftarg=text, rightarg=text, procedure=text_sx_eq,
commutator = #=)\g
d62 1
a62 3
SELECT *
FROM s
WHERE text_sx_eq(nm,'john')\g
d64 1
a64 7
SELECT *
FROM s
WHERE s.nm #= 'john';

SELECT *
FROM s
WHERE difference(s.nm, 'john') > 2;
d66 1
@


1.2
log
@Add double metaphone code from Andrew Dunstan. Also change metaphone so that
an empty input string causes an empty output string to be returned, instead of
throwing an ERROR -- per complaint from Aaron Hillegass, and consistent with
double metaphone. Fix examples in README.soundex pointed out by James Robinson.
@
text
@d10 5
d19 4
d28 1
d71 7
a77 2
from s
where s.nm #= 'john';
@


1.1
log
@Sorry - I should have gotten to this sooner. Here's a patch which you should
be able to apply against what you just committed. It rolls soundex into
fuzzystrmatch.

Remove soundex/metaphone and merge into fuzzystrmatch.

Joe Conway
@
text
@d23 1
a23 1
select nm from s a, s b
d54 1
a54 1
commutator=text_sx_eq)\g
@

