From f68fe6716c0978a3a854c4582e9566c86c7641d5 Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Mon, 2 Sep 2002 06:27:04 +0000
Subject: [PATCH] In case Florian and I don't finish his changes to this
 contrib before beta, at least get this stuff in.

ftipatch.txt - Updates to docs and scripts.  Run in the fulltextindexdir
WARNING - Add to fulltextindex dir
uninstall.sql - Add to fulltextindex dir
---
 contrib/fulltextindex/README.fti    |  2 +-
 contrib/fulltextindex/WARNING       | 25 +++++++++++++++++++++++++
 contrib/fulltextindex/fti.c         |  2 +-
 contrib/fulltextindex/fti.sql.in    |  6 +++---
 contrib/fulltextindex/uninstall.sql |  1 +
 5 files changed, 31 insertions(+), 5 deletions(-)
 create mode 100644 contrib/fulltextindex/WARNING
 create mode 100644 contrib/fulltextindex/uninstall.sql

diff --git a/contrib/fulltextindex/README.fti b/contrib/fulltextindex/README.fti
index cdf15c24da9..236e42c76fd 100644
--- a/contrib/fulltextindex/README.fti
+++ b/contrib/fulltextindex/README.fti
@@ -50,7 +50,7 @@ string), btree indices can be used by PostgreSQL.
 Now, how do we create the trigger that maintains the fti-table? First: the
 fti-table should have the following schema:
 
-	create cds-fti ( string varchar(N), id oid );
+	create cds-fti ( string varchar(N), id oid ) without oids;
 
 Don't change the *names* of the columns, the varchar() can in fact also
 be of text-type. If you do use varchar, make sure the largest possible
diff --git a/contrib/fulltextindex/WARNING b/contrib/fulltextindex/WARNING
new file mode 100644
index 00000000000..ea60db30eec
--- /dev/null
+++ b/contrib/fulltextindex/WARNING
@@ -0,0 +1,25 @@
+WARNING
+-------
+
+This implementation of full text indexing is very slow and inefficient.  It is
+STRONGLY recommended that you switch to using contrib/tsearch which offers these
+features:
+
+Advantages
+----------
+* Actively developed and improved
+* Tight integration with OpenFTS (openfts.sourceforge.net)
+* Orders of magnitude faster (eg. 300 times faster for two keyword search)
+* No extra tables or multi-way joins required
+* Select syntax allows easy 'and'ing, 'or'ing and 'not'ing of keywords
+* Built-in stemmer with customisable dictionaries (ie. searching for 'jellies' will find 'jelly')
+* Stop words automatically ignored
+* Supports non-C locales
+
+Disadvantages
+-------------
+* Only indexes full words - substring searches on words won't work.
+	eg. Searching for 'burg' won't find 'burger'
+
+Due to the deficiencies in this module, it is quite likely that it will be removed from the standard PostgreSQL distribution in the future.
+
diff --git a/contrib/fulltextindex/fti.c b/contrib/fulltextindex/fti.c
index 6c3e2fb888e..7620c0640ce 100644
--- a/contrib/fulltextindex/fti.c
+++ b/contrib/fulltextindex/fti.c
@@ -25,7 +25,7 @@
  *	  '/usr/local/pgsql/lib/contrib/fti.so' language 'C';
  *
  *	-- Create the FTI table
- *	create table product_fti (string varchar(255), id oid);
+ *	create table product_fti (string varchar(255), id oid) without oids;
  *
  *	-- Create an index to assist string matches
  *	create index product_fti_string_idx on product_fti (string);
diff --git a/contrib/fulltextindex/fti.sql.in b/contrib/fulltextindex/fti.sql.in
index c8e705b90f9..68c3f1857e1 100644
--- a/contrib/fulltextindex/fti.sql.in
+++ b/contrib/fulltextindex/fti.sql.in
@@ -1,3 +1,3 @@
-create function fti() returns trigger as
-	'MODULE_PATHNAME'
-	language 'C';
\ No newline at end of file
+CREATE OR REPLACE FUNCTION fti() RETURNS trigger AS
+	'MODULE_PATHNAME', 'fti'
+	LANGUAGE 'C' VOLATILE CALLED ON NULL INPUT;
diff --git a/contrib/fulltextindex/uninstall.sql b/contrib/fulltextindex/uninstall.sql
new file mode 100644
index 00000000000..02ad6ee602a
--- /dev/null
+++ b/contrib/fulltextindex/uninstall.sql
@@ -0,0 +1 @@
+DROP FUNCTION fti() CASCADE; 
-- 
GitLab