From 0de96f82dc9af3de8aa840fb26563481479becd6 Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Mon, 20 Jul 1998 02:45:03 +0000
Subject: [PATCH] Update fti README and stopwords.

---
 contrib/fulltextindex/README | 3 +++
 contrib/fulltextindex/fti.c  | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/contrib/fulltextindex/README b/contrib/fulltextindex/README
index 06ea57f53e7..3137e932566 100644
--- a/contrib/fulltextindex/README
+++ b/contrib/fulltextindex/README
@@ -27,6 +27,9 @@ the fti-table and the orig-table, we can get the actual rows we want
 (this can also be done by using subselects, and maybe there're other
 ways too).
 
+The trigger code also allows an array called StopWords, that prevents
+certain words from being indexed.
+
 As an example we take the previous query, where we assume we have all
 sub-strings in the table 'cds-fti':
 
diff --git a/contrib/fulltextindex/fti.c b/contrib/fulltextindex/fti.c
index 1131b6078b1..8d14f8f55c9 100644
--- a/contrib/fulltextindex/fti.c
+++ b/contrib/fulltextindex/fti.c
@@ -70,9 +70,11 @@ bool new_tuple = false;
 
 /* THIS LIST MUST BE IN SORTED ORDER, A BINARY SEARCH IS USED!!!! */
 char *StopWords[] = { 		/* list of words to skip in indexing */
+#ifdef SAMPLE_STOP_WORDS
 	"no"
 	"the",
 	"yes",
+#endif
 };
 
 /* stuff for caching query-plans, stolen from contrib/spi/\*.c */
@@ -331,6 +333,9 @@ is_stopword(char *text)
 	StopLow = &StopWords[0];		/* initialize stuff for binary search */
 	StopHigh = endof(StopWords);
 
+	if (lengthof(StopWords) == 0)
+		return false;
+		
     while (StopLow <= StopHigh)
     {
         StopMiddle = StopLow + (StopHigh - StopLow) / 2;
-- 
GitLab