25 lines
727 B
Text
25 lines
727 B
Text
install fts; -- once should be enough
|
|
|
|
load fts;
|
|
create or replace table texts as (from read_text('inv*.txt'));
|
|
|
|
pragma create_fts_index(
|
|
'texts', -- table name
|
|
'filename', -- column name
|
|
'content', -- column name of text
|
|
stemmer = 'english',
|
|
stopwords = 'none',
|
|
strip_accents = 1,
|
|
lower = 1, -- ignore case
|
|
overwrite = 1);
|
|
|
|
# Simple interface to match_bm25 for conjunctive queries:
|
|
create or replace function s(queryString) as table (
|
|
select filename,
|
|
content,
|
|
fts_main_texts.match_bm25( filename,
|
|
queryString,
|
|
conjunctive := 1) as score
|
|
from texts
|
|
where score IS NOT NULL
|
|
);
|