Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fts/src/function/fts_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ CreateFTSConfig::CreateFTSConfig(main::ClientContext& context, common::table_id_
StopWords::bind(context, tableID, indexName, value.getValue<std::string>());
} else if (IgnorePattern::NAME == lowerCaseName) {
value.validateType(IgnorePattern::TYPE);
ignorePattern = common::StringUtils::getLower(value.getValue<std::string>());
ignorePattern = value.getValue<std::string>();
// Wildcard characters ('*' and '?') are protected from the ignore pattern during
// query normalization (see FTSUtils::normalizeQuery), so the same pattern is used
// for indexing and for queries.
Expand Down
34 changes: 34 additions & 0 deletions fts/test/test_files/ignore_pattern.test
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,37 @@
-STATEMENT CALL QUERY_FTS_INDEX('emails', 'fileIdx', '102') RETURN node.id;
---- 1
10

# The pattern is matched against the text as written, before it is lowercased, so the case of
# letters in the pattern must be kept.
-CASE ignorePatternKeepsCase
-LOAD_DYNAMIC_EXTENSION fts
-STATEMENT CREATE NODE TABLE Doc(id INT64 PRIMARY KEY, body STRING);
---- ok
-STATEMENT CREATE (:Doc {id: 1, body: 'Ladybug Graph'});
---- ok
-STATEMENT CALL CREATE_FTS_INDEX('Doc', 'letters', ['body'], stemmer := 'none', ignore_pattern := '[^A-Za-z]+');
---- ok
-STATEMENT CALL CREATE_FTS_INDEX('Doc', 'words', ['body'], stemmer := 'none', ignore_pattern := '\\W+');
---- ok
-STATEMENT CREATE (:Doc {id: 2, body: 'Quiet Morning'});
---- ok
-STATEMENT CALL QUERY_FTS_INDEX('Doc', 'letters', 'ladybug') RETURN node.id;
---- 1
1
-STATEMENT CALL QUERY_FTS_INDEX('Doc', 'letters', 'adybug') RETURN node.id;
---- 0
-STATEMENT CALL QUERY_FTS_INDEX('Doc', 'letters', 'Morning') RETURN node.id;
---- 1
2
-STATEMENT CALL QUERY_FTS_INDEX('Doc', 'words', 'graph') RETURN node.id;
---- 1
1
-STATEMENT CALL QUERY_FTS_INDEX('Doc', 'words', 'quiet') RETURN node.id;
---- 1
2
-RELOADDB
-LOAD_DYNAMIC_EXTENSION fts
-STATEMENT CALL QUERY_FTS_INDEX('Doc', 'letters', 'graph') RETURN node.id;
---- 1
1
Loading