alexander.behm | c576c60 | 2012-07-06 02:41:15 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Description : Tests whether an ngram_index is applied to optimize a selection query using the edit-distance-check function on strings. |
| 3 | * The index should *not* be applied (see below). |
| 4 | * Success : Yes |
| 5 | */ |
| 6 | |
| 7 | drop dataverse test if exists; |
| 8 | create dataverse test; |
| 9 | use dataverse test; |
| 10 | |
| 11 | create type DBLPType as closed { |
| 12 | id: int32, |
| 13 | dblpid: string, |
| 14 | title: string, |
| 15 | authors: string, |
| 16 | misc: string |
| 17 | } |
| 18 | |
ramangrover29 | 669d8f6 | 2013-02-11 06:03:32 +0000 | [diff] [blame^] | 19 | create dataset DBLP(DBLPType) primary key id; |
alexander.behm | c576c60 | 2012-07-06 02:41:15 +0000 | [diff] [blame] | 20 | |
alexander.behm | c576c60 | 2012-07-06 02:41:15 +0000 | [diff] [blame] | 21 | create index ngram_index on DBLP(authors) type ngram(3); |
| 22 | |
| 23 | write output to nc1:"rttest/inverted-index-basic_ngram-edit-distance-check-panic.adm"; |
| 24 | |
| 25 | // This query cannot be optimized with an index, based on the high edit distance. |
| 26 | for $o in dataset('DBLP') |
| 27 | let $ed := edit-distance-check($o.authors, "Amihay Motro", 5) |
| 28 | where $ed[0] |
| 29 | return $o |