mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-24 04:07:47 +00:00
Documentation
This commit is contained in:
1 parent
b85066eb06
commit
12ca7d0fe2
1 file changed
+4
-4
@@ -3197,20 +3197,20 @@ try db.create(virtualTable: "books", using: FTS4()) { t in // or FTS3(), or FTS5
|
||||
t.column("body")
|
||||
}
|
||||
|
||||
// Populate full-text table with SQL or records
|
||||
// Populate full-text table with records or SQL
|
||||
try Book(...).insert(db)
|
||||
try db.execute(
|
||||
"INSERT INTO books (uuid, author, title, body) VALUES (?, ?, ?, ?)",
|
||||
arguments: [...])
|
||||
try Book(...).insert(db)
|
||||
|
||||
// Build search patterns
|
||||
let pattern = FTS3Pattern(matchingPhrase: "Moby-Dick")
|
||||
|
||||
// Search with SQL or the query interface
|
||||
// Search with the query interface or SQL
|
||||
let books = Book.matching(pattern).fetchAll(db)
|
||||
let books = Book.fetchAll(db,
|
||||
"SELECT * FROM books WHERE books MATCH ?",
|
||||
arguments: [pattern])
|
||||
let books = Book.matching(pattern).fetchAll(db)
|
||||
```
|
||||
|
||||
- [Choosing the Full-Text Engine](#choosing-the-full-text-engine)
|
||||
|
||||
Reference in new issue
Block a user