diff --git a/src/backend/utils/adt/tsginidx.c b/src/backend/utils/adt/tsginidx.c
index 2d656168fc..733e67117a 100644
--- a/src/backend/utils/adt/tsginidx.c
+++ b/src/backend/utils/adt/tsginidx.c
@@ -251,6 +251,8 @@ TS_execute_ternary(GinChkVal *gcv, QueryItem *curitem, bool in_phrase)
 			result = TS_execute_ternary(gcv, curitem + 1, in_phrase);
 			if (result == GIN_MAYBE)
 				return result;
+			if ((curitem+1)->qoperand.weight && ((curitem+1)->qoperand.weight < 15))
+				return GIN_MAYBE;
 			return !result;
 
 		case OP_PHRASE:
diff --git a/src/test/regress/expected/gin.out b/src/test/regress/expected/gin.out
index 83de5220fb..c94fa6fad5 100644
--- a/src/test/regress/expected/gin.out
+++ b/src/test/regress/expected/gin.out
@@ -202,3 +202,21 @@ from
 reset enable_seqscan;
 reset enable_bitmapscan;
 drop table t_gin_test_tbl;
+CREATE TABLE test_weight (fts tsvector);
+INSERT INTO test_weight (fts) values ('crew:1C shuttl:2C'::tsvector);
+SET enable_seqscan=on;
+select * from test_weight where fts @@ to_tsquery('pg_catalog.english', 'shuttle & !crew:a');
+          fts          
+-----------------------
+ 'crew':1C 'shuttl':2C
+(1 row)
+
+CREATE INDEX setweight_fts_idx ON test_weight USING gin (fts);
+SET enable_seqscan=off;
+select * from test_weight where fts @@ to_tsquery('pg_catalog.english', 'shuttle & !crew:a');
+          fts          
+-----------------------
+ 'crew':1C 'shuttl':2C
+(1 row)
+
+DROP TABLE test_weight;
diff --git a/src/test/regress/sql/gin.sql b/src/test/regress/sql/gin.sql
index abe3575265..a76323b754 100644
--- a/src/test/regress/sql/gin.sql
+++ b/src/test/regress/sql/gin.sql
@@ -139,3 +139,12 @@ reset enable_seqscan;
 reset enable_bitmapscan;
 
 drop table t_gin_test_tbl;
+CREATE TABLE test_weight (fts tsvector);
+INSERT INTO test_weight (fts) values ('crew:1C shuttl:2C'::tsvector);
+
+SET enable_seqscan=on;
+select * from test_weight where fts @@ to_tsquery('pg_catalog.english', 'shuttle & !crew:a');
+CREATE INDEX setweight_fts_idx ON test_weight USING gin (fts);
+SET enable_seqscan=off;
+select * from test_weight where fts @@ to_tsquery('pg_catalog.english', 'shuttle & !crew:a');
+DROP TABLE test_weight;
