Extensions
Example Usage
Create a table and fill it with text data:  
```sql
CREATE TABLE documents (
document_identifier VARCHAR,
text_content VARCHAR,
author VARCHAR,
doc_version INTEGER
);
INSERT INTO documents
VALUES ('doc1',
'The mallard is a dabbling duck that breeds throughout the temperate.',
'Hannes Mühleisen',
3),
('doc2',
'The cat is a domestic species of small carnivorous mammal.',
'Laurens Kuiper',
2
);
```  
Build the index, and make both the `text_content` and `author` columns searchable.  
```sql
PRAGMA create_fts_index(
'documents', 'document_identifier', 'text_content', 'author'
);
```  
Search the `author` field index for documents that are authored by `Muhleisen`. This retrieves `doc1`:  
```sql
SELECT document_identifier, text_content, score
FROM (
SELECT *, fts_main_documents.match_bm25(
document_identifier,
'Muhleisen',
fields := 'author'
) AS score
FROM documents
) sq
WHERE score IS NOT NULL
AND doc_version > 2
ORDER BY score DESC;
```  
| document_identifier |                             text_content                             | score |
|---------------------|----------------------------------------------------------------------|------:|
| doc1                | The mallard is a dabbling duck that breeds throughout the temperate. | 0.0   |  
Search for documents about `small cats`. This retrieves `doc2`:  
```sql
SELECT document_identifier, text_content, score
FROM (
SELECT *, fts_main_documents.match_bm25(
document_identifier,
'small cats'
) AS score
FROM documents
) sq
WHERE score IS NOT NULL
ORDER BY score DESC;
```  
| document_identifier |                        text_content                        | score |
|---------------------|------------------------------------------------------------|------:|
| doc2                | The cat is a domestic species of small carnivorous mammal. | 0.0   |  
> **Warning.  ** The FTS index will not update automatically when input table changes.
> A workaround of this limitation can be recreating the index to refresh.