Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Add Full Text Search Description to PGroonga

askdkc88b7ff8ff24d
diff --git a/apps/docs/pages/guides/database/extensions/pgroonga.mdx b/apps/docs/pages/guides/database/extensions/pgroonga.mdx
index e8256f4d3cb..e8f07c2e2cd 100644
--- a/apps/docs/pages/guides/database/extensions/pgroonga.mdx
+++ b/apps/docs/pages/guides/database/extensions/pgroonga.mdx
@@ -100,6 +100,75 @@ The pgroonga index is used to retrive the result set:
| 2 | 'Groonga is a fast full text search engine that supports all languages.' |
```
+## Full Text Search
+The &@~ symbol operator is for Full Text Search. It returns any matches result. Unlike `LIKE` operator, pgroonga can search any text that contains the keyword case insensitive.
+
+Take the following example:
+
+{/* prettier-ignore */}
+```sql
+select * from memos where content &@~ 'groonga';
+```
+
+And the result:
+```markdown
+ id | content
+----+------------------------------------------------------------------------
+ 2 | Groonga is a fast full text search engine that supports all languages.
+ 3 | PGroonga is a PostgreSQL extension that uses Groonga as index.
+ 4 | There is groonga command.
+(3 rows)
+```
+
+### Match all search words
+To find all memos where content contains BOTH of the words postgres and postgres, we can just use space to separate each words:
+
+{/* prettier-ignore */}
+```sql
+select * from memos where content &@~ 'postgres pgroonga';
+```
+
+And the result:
+```markdown
+ id | content
+----+----------------------------------------------------------------
+ 3 | PGroonga is a PostgreSQL extension that uses Groonga as index.
+(1 row)
+```
+
+### Match any search words
+To find all memos where content contain ANY of the words postgres or postgres, use the upper case OR:
+
+{/* prettier-ignore */}
+```sql
+select * from memos where content &@~ 'postgres OR pgroonga';
+```
+
+And the result:
+```markdown
+ id | content
+----+----------------------------------------------------------------
+ 1 | PostgreSQL is a relational database management system.
+ 3 | PGroonga is a PostgreSQL extension that uses Groonga as index.
+(2 rows)
+```
+
+### Search that matches words with negation
+To find all memos where content contain the word postgres but not pgroonga, use - symbol:
+
+{/* prettier-ignore */}
+```sql
+select * from memos where content &@~ 'postgres -pgroonga';
+```
+
+And the result:
+```markdown
+ id | content
+----+--------------------------------------------------------
+ 1 | PostgreSQL is a relational database management system.
+(1 row)
+```
+
## Resources
- Official [PGroonga documentation](https://pgroonga.github.io/tutorial/)