vinayakb | 5ee049d | 2013-04-06 21:21:29 +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 | * Tests that the optimizer rule correctly drills through the let clauses. |
| 4 | * The index should *not* be applied (see below). |
| 5 | * Success : Yes |
| 6 | */ |
| 7 | |
| 8 | drop dataverse test if exists; |
| 9 | create dataverse test; |
| 10 | use dataverse test; |
| 11 | |
| 12 | create type DBLPType as closed { |
| 13 | id: int32, |
| 14 | dblpid: string, |
| 15 | title: string, |
| 16 | authors: string, |
| 17 | misc: string |
| 18 | } |
| 19 | |
| 20 | create dataset DBLP(DBLPType) primary key id; |
| 21 | |
| 22 | create index ngram_index on DBLP(authors) type ngram(3); |
| 23 | |
| 24 | write output to nc1:"rttest/inverted-index-complex_ngram-edit-distance-check-let-panic.adm"; |
| 25 | |
| 26 | // This query cannot be optimized with an index, based on the high edit distance. |
| 27 | for $o in dataset('DBLP') |
| 28 | let $ed := edit-distance-check($o.authors, "Amihay Motro", 5) |
| 29 | where $ed[0] |
| 30 | return $o |