Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pat_fuzzy: fix memory leak that prefix query isn't match any tokens
- Loading branch information
Showing
5 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
test/command/suite/select/function/fuzzy_search/index/prefix.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| table_create Users TABLE_NO_KEY | ||
| [[0,0.0,0.0],true] | ||
| column_create Users name COLUMN_SCALAR ShortText | ||
| [[0,0.0,0.0],true] | ||
| table_create Names TABLE_PAT_KEY ShortText | ||
| [[0,0.0,0.0],true] | ||
| column_create Names user COLUMN_INDEX Users name | ||
| [[0,0.0,0.0],true] | ||
| load --table Users | ||
| [ | ||
| {"name": "Tom"}, | ||
| {"name": "Tomy"}, | ||
| {"name": "Pom"}, | ||
| {"name": "Tom"} | ||
| ] | ||
| [[0,0.0,0.0],4] | ||
| select Users --filter 'fuzzy_search(name, "Tom", {"prefix_length": 1})' --output_columns 'name, _score' --match_escalation_threshold -1 | ||
| [ | ||
| [ | ||
| 0, | ||
| 0.0, | ||
| 0.0 | ||
| ], | ||
| [ | ||
| [ | ||
| [ | ||
| 3 | ||
| ], | ||
| [ | ||
| [ | ||
| "name", | ||
| "ShortText" | ||
| ], | ||
| [ | ||
| "_score", | ||
| "Int32" | ||
| ] | ||
| ], | ||
| [ | ||
| "Tom", | ||
| 2 | ||
| ], | ||
| [ | ||
| "Tomy", | ||
| 1 | ||
| ], | ||
| [ | ||
| "Tom", | ||
| 2 | ||
| ] | ||
| ] | ||
| ] | ||
| ] |
17 changes: 17 additions & 0 deletions
17
test/command/suite/select/function/fuzzy_search/index/prefix.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| table_create Users TABLE_NO_KEY | ||
| column_create Users name COLUMN_SCALAR ShortText | ||
|
|
||
| table_create Names TABLE_PAT_KEY ShortText | ||
| column_create Names user COLUMN_INDEX Users name | ||
|
|
||
| load --table Users | ||
| [ | ||
| {"name": "Tom"}, | ||
| {"name": "Tomy"}, | ||
| {"name": "Pom"}, | ||
| {"name": "Tom"} | ||
| ] | ||
|
|
||
| select Users --filter 'fuzzy_search(name, "Tom", {"prefix_length": 1})' \ | ||
| --output_columns 'name, _score' \ | ||
| --match_escalation_threshold -1 |
18 changes: 18 additions & 0 deletions
18
test/command/suite/select/function/fuzzy_search/index/prefix_no_match.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| table_create Users TABLE_NO_KEY | ||
| [[0,0.0,0.0],true] | ||
| column_create Users name COLUMN_SCALAR ShortText | ||
| [[0,0.0,0.0],true] | ||
| table_create Names TABLE_PAT_KEY ShortText | ||
| [[0,0.0,0.0],true] | ||
| column_create Names user COLUMN_INDEX Users name | ||
| [[0,0.0,0.0],true] | ||
| load --table Users | ||
| [ | ||
| {"name": "Tom"}, | ||
| {"name": "Tomy"}, | ||
| {"name": "Pom"}, | ||
| {"name": "Tom"} | ||
| ] | ||
| [[0,0.0,0.0],4] | ||
| select Users --filter 'fuzzy_search(name, "Atom", {"prefix_length": 1})' --output_columns 'name, _score' --match_escalation_threshold -1 | ||
| [[0,0.0,0.0],[[[0],[["name","ShortText"],["_score","Int32"]]]]] |
17 changes: 17 additions & 0 deletions
17
test/command/suite/select/function/fuzzy_search/index/prefix_no_match.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| table_create Users TABLE_NO_KEY | ||
| column_create Users name COLUMN_SCALAR ShortText | ||
|
|
||
| table_create Names TABLE_PAT_KEY ShortText | ||
| column_create Names user COLUMN_INDEX Users name | ||
|
|
||
| load --table Users | ||
| [ | ||
| {"name": "Tom"}, | ||
| {"name": "Tomy"}, | ||
| {"name": "Pom"}, | ||
| {"name": "Tom"} | ||
| ] | ||
|
|
||
| select Users --filter 'fuzzy_search(name, "Atom", {"prefix_length": 1})' \ | ||
| --output_columns 'name, _score' \ | ||
| --match_escalation_threshold -1 |