-DATASET CSV fts-small

--

# These ground truth numbers were obtained from DuckDB and we double checked that
# our results and DuckDB's results is within three decimal places.
-CASE fts_search_simple
-LOAD_DYNAMIC_EXTENSION fts
-STATEMENT CALL CREATE_FTS_INDEX('doc', 'docIdx', ['content', 'author', 'name'])
---- ok
-LOG SingleKeyWordUpperCase
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx', 'Alice') RETURN node.ID, score
---- 2
0|0.271133
3|0.209476
-LOG SingleKeyWordLowerCase
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx', 'alice') RETURN node.ID, score
---- 2
0|0.271133
3|0.209476
-LOG QueryEmptyString
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx', '') RETURN node.ID, score
---- 0
-LOG QueryStopWord
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx', 'at') RETURN node.ID, score
---- 0
-LOG QuerySingular
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx', 'studys') RETURN node.ID, score
---- 3
0|0.055171
20|0.059514
3|0.059514
-LOG QueryPresentTense
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx', 'studying') RETURN node.ID, score
---- 3
0|0.055171
20|0.059514
3|0.059514
-LOG QueryWithSpecialChar
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx', 'study ->') RETURN node.ID, score
---- 3
0|0.055171
20|0.059514
3|0.059514
-LOG MultipleIndexes
-STATEMENT CALL CREATE_FTS_INDEX('doc', 'docIdx1', ['content', 'author'])
---- ok
-STATEMENT CALL CREATE_FTS_INDEX('doc', 'docIdx2', ['content'])
---- ok
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx', 'toronto') RETURN node.ID, score
---- 1
0|0.565815
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx1', 'toronto') RETURN node.ID, score
---- 1
0|0.400747
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx2', 'toronto') RETURN node.ID, score
---- 1
0|0.393753
-LOG DropAndRecreate
-STATEMENT CALL CREATE_FTS_INDEX('doc', 'docIdx4', ['content', 'name'])
---- ok
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx4', 'waterloo') RETURN node.ID, score
---- 2
0|0.192034
20|0.210752
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx', 'studying') yield node as studyNode, score as studyScore CALL QUERY_FTS_INDEX('doc', 'docIdx', 'alice') yield node as aliceNode, score as aliceScore RETURN studyNode.ID, aliceNode.ID,aliceScore
---- 6
0|0|0.271133
0|3|0.209476
20|0|0.271133
20|3|0.209476
3|0|0.271133
3|3|0.209476
 -STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx4', 'waterloo') with node.ID as ID, score as score MATCH (n) RETURN ID, score, label(n)
---- 18
0|0.192034|city_stopwords
0|0.192034|city_stopwords
0|0.192034|city_stopwords
20|0.210752|city_stopwords
20|0.210752|city_stopwords
20|0.210752|city_stopwords
0|0.192034|doc
0|0.192034|doc
0|0.192034|doc
20|0.210752|doc
20|0.210752|doc
20|0.210752|doc
0|0.192034|name_stopwords
0|0.192034|name_stopwords
0|0.192034|name_stopwords
20|0.210752|name_stopwords
20|0.210752|name_stopwords
20|0.210752|name_stopwords

-CASE FTSWithParams
-LOAD_DYNAMIC_EXTENSION fts
-LOG StemmerOption
-STATEMENT CALL CREATE_FTS_INDEX('doc', 'docIdx', ['content', 'author', 'name'], stemmer := 'german1')
---- error
Binder exception: Unrecognized stemmer 'german1'. Supported stemmers are: ['arabic, basque, catalan, danish, dutch, english, finnish, french, german, greek, hindi, hungarian, indonesian, irish, italian, lithuanian, nepali, norwegian, porter, portuguese, romanian, russian, serbian, spanish, swedish, tamil, turkish'], or use 'none' for no stemming.
-STATEMENT CALL CREATE_FTS_INDEX('doc', 'docIdx', ['content', 'author', 'name'], stemmer := 'araBic')
---- ok
#Note: arabic stemmer doesn't reduce studys/studying->study
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx', 'study') RETURN node.ID, score
---- 1
20|0.437146
-STATEMENT CALL CREATE_FTS_INDEX('doc', 'docIdx1', ['content', 'author', 'name'], stemmer := 'frEnch')
---- ok
#Note: french stemmer doesn't reduce studying->study
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx1', 'study') RETURN node.ID, score
---- 2
0|0.194190
20|0.209476
-STATEMENT CALL CREATE_FTS_INDEX('doc', 'docIdx2', ['content', 'author', 'name'], stemmer := 'nOne')
---- ok
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx2', 'studying') RETURN node.ID, score
---- 1
3|0.437146
-LOG CreateFTSIncorrectParam
-STATEMENT CALL CREATE_FTS_INDEX('doc', 'docIdx5', ['content', 'author', 'name'], test := 'nOne')
---- error
Binder exception: Unrecognized optional parameter: test
-LOG CreateFTSOnNonStringProp
-STATEMENT CREATE NODE TABLE teacher (ID INT64, age INT64, PRIMARY KEY(ID))
---- ok
-LOG CreateFTSIncorrectParamType
-STATEMENT CALL CREATE_FTS_INDEX('doc', 'docIdx5', ['content', 'author', 'name'], stemmer := 25)
---- error
Binder exception: 25 has data type INT64 but STRING was expected.
-LOG QueryFTSOptionalParam
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx1', 'study', k := 0.3, B:= 0.5) RETURN node.ID, score
---- 2
0|0.201218
20|0.205603
-LOG QueryFTSOptionalParamError
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx1', 'study', k := 0.3, c:= 0.5) RETURN node.ID, score
---- error
Binder exception: Unknown optional parameter: c
-LOG QueryFTSBOutOfRange
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx1', 'study', k := 0.3, B:= 3.88) RETURN node.ID, score
---- error
Binder exception: BM25 model requires the Document Length Normalization(b) value to be in the range [0,1].
-LOG QueryFTSKOutOfRange
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx1', 'study', k := -5.3, B:= 0.7) RETURN node.ID, score
---- error
Binder exception: BM25 model requires the Term Frequency Saturation(k) value to be a positive number.

-CASE fts_conjunctive_case
-LOAD_DYNAMIC_EXTENSION fts
-STATEMENT CALL CREATE_FTS_INDEX('doc', 'docIdx', ['content', 'author', 'name'])
---- ok
-LOG QueryFTSConjunctiveSingleKeyword
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx', 'alice', conjunctive := true) RETURN node.ID, score
---- 2
0|0.271133
3|0.209476
-LOG QueryFTSConjunctiveMultiKeywords
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx', 'alice studying', conjunctive := true) RETURN node.ID, score
---- 2
0|0.326304
3|0.268990
-LOG QueryFTSConjunctiveMultiKeywordsAndStopWords
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx', 'alice and studying', conjunctive := true) RETURN node.ID, score
---- 2
0|0.326304
3|0.268990
-LOG QueryFTSConjunctiveMultiKeywordsAndStopWords1
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx', 'study in', conjunctive := true) RETURN node.ID, score
---- 3
0|0.055171
20|0.059514
3|0.059514
-LOG QueryFTSConjunctiveDuplicateKeywords
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx', 'alice studying alice', conjunctive := true) RETURN node.ID, score
---- 2
0|0.326304
3|0.268990
-LOG QueryFTSConjunctiveDuplicateSingleKeyword
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx', 'alice alice', conjunctive := true) RETURN node.ID, score
---- 2
0|0.271133
3|0.209476
-LOG QueryFTSConjunctiveNotExistSingleKeyword
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx', 'carol', conjunctive := true) RETURN node.ID, score
---- 0
-LOG QueryFTSConjunctiveNotExistMultiKeywords
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx', 'carol dog', conjunctive := true) RETURN node.ID, score
---- 0
-LOG QueryFTSConjunctivePartialExistKeyword
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx', 'alice carol', conjunctive := true) RETURN node.ID, score
---- 0
-LOG QueryFTSConjunctivePartialExistKeyword
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx', 'alice waterloo', conjunctive := true) RETURN node.ID, score
---- 1
0|0.465323
-CASE fts_serialization
-SKIP_IN_MEM
-SKIP_STATIC_LINK
-LOAD_DYNAMIC_EXTENSION fts
-STATEMENT CALL CREATE_FTS_INDEX('doc', 'docIdx', ['content', 'author', 'name'])
---- ok
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx', 'Alice') RETURN node.ID, score
---- 2
0|0.271133
3|0.209476
-RELOADDB
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx', 'Alice') RETURN node.ID, score
---- error
Catalog exception: function QUERY_FTS_INDEX is not defined. This function exists in the FTS extension. You can install and load the extension by running 'INSTALL FTS; LOAD EXTENSION FTS;'.
-LOAD_DYNAMIC_EXTENSION fts
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx', 'Alice') RETURN node.ID, score
---- 2
0|0.271133
3|0.209476
-CASE FTSWithPortDB
-SKIP_IN_MEM
-LOAD_DYNAMIC_EXTENSION fts
-STATEMENT CALL CREATE_FTS_INDEX('doc', 'docIdx', ['content', 'author', 'name'])
---- ok
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx', 'Alice') RETURN node.ID, score
---- 2
0|0.271133
3|0.209476
-STATEMENT EXPORT DATABASE '${KUZU_EXPORT_DB_DIRECTORY}_fts/small'
---- ok
-IMPORT_DATABASE "${KUZU_EXPORT_DB_DIRECTORY}_fts/small"
-STATEMENT IMPORT DATABASE '${KUZU_EXPORT_DB_DIRECTORY}_fts/small';
---- ok
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx', 'Alice') RETURN node.ID, score
---- 2
0|0.271133
3|0.209476

-CASE ValidateInternalTableSeq
-LOAD_DYNAMIC_EXTENSION fts
-STATEMENT CALL CREATE_FTS_INDEX('doc', 'docIdx', ['content', 'author', 'name'])
---- ok
-STATEMENT MATCH (c) return label(c)
---- 9
city_stopwords
city_stopwords
city_stopwords
doc
doc
doc
name_stopwords
name_stopwords
name_stopwords
-STATEMENT MATCH (d:`0_docIdx_docs`) return d.*
---- error
Binder exception: Table 0_docIdx_docs does not exist.
-STATEMENT call show_tables() return *
---- 6
0|doc|NODE|local(kuzu)|
1|city_stopwords|NODE|local(kuzu)|
2|name_stopwords|NODE|local(kuzu)|
4|likes|REL|local(kuzu)|
5|INVALID_STOPWORDS|NODE|local(kuzu)|
6|INVALID_STOPWORDS_COL_TYPE|NODE|local(kuzu)|
-STATEMENT DROP TABLE `0_docIdx_docs`
---- error
Binder exception: Table 0_docIdx_docs does not exist.
-STATEMENT ALTER TABLE `0_docIdx_docs` ADD TEST1 int64
---- error
Catalog exception: 0_docIdx_docs does not exist in catalog.
-STATEMENT CALL PROJECT_GRAPH('PK1', ['0_docIdx_docs'], [])
---- error
Binder exception: Table 0_docIdx_docs does not exist.
-STATEMENT RETURN nextval('0_docIdx_appears_info_ID_serial');
---- error
Catalog exception: 0_docIdx_appears_info_ID_serial does not exist in catalog.
-STATEMENT DROP SEQUENCE `0_docIdx_appears_info_ID_serial`
---- error
Binder exception: Sequence 0_docIdx_appears_info_ID_serial does not exist.

-CASE InternalTableNamingConflict
-LOAD_DYNAMIC_EXTENSION fts
-STATEMENT CALL CREATE_FTS_INDEX('doc', 'docIdx', ['content', 'author', 'name'])
---- ok
-STATEMENT create node table `0_docIdx_docs` (id int64, primary key(id))
---- error
Binder exception: 0_docIdx_docs already exists in catalog.
 -STATEMENT create node table `0_docIdx1_docs` (id int64, primary key(id))
---- ok
-STATEMENT CALL CREATE_FTS_INDEX('doc', 'docIdx1', ['content'])
---- error
Binder exception: Table: 0_docIdx1_docs already exists. Please drop or rename the table before creating a full text search index.
-STATEMENT create node table `0_docIdx2_terms` (id int64, primary key(id))
---- ok
-STATEMENT CALL CREATE_FTS_INDEX('doc', 'docIdx2', ['content'])
---- error
Binder exception: Table: 0_docIdx2_terms already exists. Please drop or rename the table before creating a full text search index.
-STATEMENT create rel table `0_docIdx3_appears_info` (from doc to doc)
---- ok
-STATEMENT CALL CREATE_FTS_INDEX('doc', 'docIdx3', ['content'])
---- error
Binder exception: Table: 0_docIdx3_appears_info already exists. Please drop or rename the table before creating a full text search index.
-STATEMENT create rel table `0_docIdx4_appears_in` (from doc to doc)
---- ok
-STATEMENT CALL CREATE_FTS_INDEX('doc', 'docIdx4', ['content'])
---- error
Binder exception: Table: 0_docIdx4_appears_in already exists. Please drop or rename the table before creating a full text search index.
 -CASE show_indexes
-SKIP_IN_MEM
-SKIP_STATIC_LINK
-LOAD_DYNAMIC_EXTENSION fts
-STATEMENT CALL CREATE_FTS_INDEX('doc', 'docIdx', ['content', 'author', 'name'])
---- ok
-STATEMENT CALL CREATE_FTS_INDEX('doc', 'docIdx1', ['content'])
---- ok
-STATEMENT CALL SHOW_INDEXES() RETURN *
---- 2
doc|docIdx1|FTS|[content]|True|CALL CREATE_FTS_INDEX('doc', 'docIdx1', ['content'], stemmer := 'english', stopWords := 'default');
doc|docIdx|FTS|[content,author,name]|True|CALL CREATE_FTS_INDEX('doc', 'docIdx', ['content', 'author', 'name'], stemmer := 'english', stopWords := 'default');
-STATEMENT CALL SHOW_INDEXES() RETURN *
---- 2
doc|docIdx1|FTS|[content]|True|CALL CREATE_FTS_INDEX('doc', 'docIdx1', ['content'], stemmer := 'english', stopWords := 'default');
doc|docIdx|FTS|[content,author,name]|True|CALL CREATE_FTS_INDEX('doc', 'docIdx', ['content', 'author', 'name'], stemmer := 'english', stopWords := 'default');
-RELOADDB
-STATEMENT CALL SHOW_INDEXES() RETURN *
---- 2
doc|docIdx1|FTS|[content]|False|
doc|docIdx|FTS|[content,author,name]|False|
-LOAD_DYNAMIC_EXTENSION fts
-STATEMENT CALL SHOW_INDEXES() RETURN *
---- 2
doc|docIdx1|FTS|[content]|True|CALL CREATE_FTS_INDEX('doc', 'docIdx1', ['content'], stemmer := 'english', stopWords := 'default');
doc|docIdx|FTS|[content,author,name]|True|CALL CREATE_FTS_INDEX('doc', 'docIdx', ['content', 'author', 'name'], stemmer := 'english', stopWords := 'default');
-STATEMENT ALTER TABLE doc RENAME content to detail
---- ok
-STATEMENT CALL SHOW_INDEXES() RETURN *
---- 2
doc|docIdx1|FTS|[detail]|True|CALL CREATE_FTS_INDEX('doc', 'docIdx1', ['detail'], stemmer := 'english', stopWords := 'default');
doc|docIdx|FTS|[detail,author,name]|True|CALL CREATE_FTS_INDEX('doc', 'docIdx', ['detail', 'author', 'name'], stemmer := 'english', stopWords := 'default');
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx', 'Alice') RETURN node.ID, score
---- 2
0|0.271133
3|0.209476
-STATEMENT CREATE NODE TABLE student(ID INT64, age INT64, name STRING, primary key(ID))
---- ok
-STATEMENT CALL CREATE_FTS_INDEX('student', 'studentIdx', ['name'])
---- ok
-STATEMENT CALL SHOW_INDEXES() WHERE table_name = 'student' RETURN *
---- 1
student|studentIdx|FTS|[name]|True|CALL CREATE_FTS_INDEX('student', 'studentIdx', ['name'], stemmer := 'english', stopWords := 'default');
-STATEMENT ALTER TABLE student drop age
---- ok
-STATEMENT CALL SHOW_INDEXES() WHERE table_name = 'student' RETURN *
---- 1
student|studentIdx|FTS|[name]|True|CALL CREATE_FTS_INDEX('student', 'studentIdx', ['name'], stemmer := 'english', stopWords := 'default');
-STATEMENT ALTER TABLE student rename name to firstName
---- ok
-STATEMENT CALL SHOW_INDEXES() WHERE table_name = 'student' RETURN *
---- 1
student|studentIdx|FTS|[firstName]|True|CALL CREATE_FTS_INDEX('student', 'studentIdx', ['firstName'], stemmer := 'english', stopWords := 'default');

-CASE FTSWithPortDBUnloadedExtension
-SKIP_STATIC_LINK
-SKIP_IN_MEM
-LOAD_DYNAMIC_EXTENSION fts
-STATEMENT CALL CREATE_FTS_INDEX('doc', 'docIdx', ['content', 'author', 'name'])
---- ok
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx', 'Alice') RETURN node.ID, score
---- 2
0|0.271133
3|0.209476
-RELOADDB
-STATEMENT EXPORT DATABASE '${KUZU_EXPORT_DB_DIRECTORY}_fts/fts_small_export_test'
---- ok
-IMPORT_DATABASE "${KUZU_EXPORT_DB_DIRECTORY}_fts/fts_small_export_test"
-STATEMENT IMPORT DATABASE '${KUZU_EXPORT_DB_DIRECTORY}_fts/fts_small_export_test'
---- ok
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx', 'Alice') RETURN node.ID, score
---- error
Catalog exception: function QUERY_FTS_INDEX is not defined. This function exists in the FTS extension. You can install and load the extension by running 'INSTALL FTS; LOAD EXTENSION FTS;'.
-LOAD_DYNAMIC_EXTENSION fts
-STATEMENT CALL QUERY_FTS_INDEX('doc', 'docIdx', 'Alice') RETURN node.ID, score
---- error
Binder exception: Table doc doesn't have an index with name docIdx.

-CASE RussianDoc
-LOAD_DYNAMIC_EXTENSION fts
-STATEMENT CREATE NODE TABLE Documents (ID SERIAL, title STRING, text STRING, PRIMARY KEY (ID));
---- ok
-STATEMENT CREATE (b:Documents {title: 'one', text: 'Многоклеточный Какие'});
---- ok
-STATEMENT CREATE (b:Documents {title: 'two', text: 'Какие'});
---- ok
-STATEMENT CREATE (b:Documents {title: 'three', text: 'часто относят к колониальным организмам'});
---- ok
-STATEMENT CALL CREATE_FTS_INDEX('Documents', 'documents_index', ['text'], stemmer := 'russian');
---- ok
-STATEMENT CALL QUERY_FTS_INDEX('Documents', 'documents_index', 'Какие') RETURN node.title;
---- 2
one
two
-STATEMENT CALL QUERY_FTS_INDEX('Documents', 'documents_index', 'какие') RETURN node.title;
---- 2
one
two
