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 similarity-jaccard-check function on 3-gram tokens. |
| 3 | * Tests that the optimizer rule correctly drills through the let clauses. |
| 4 | * The index should be applied. |
| 5 | * Success : Yes |
| 6 | */ |
| 7 | |
| 8 | drop dataverse test if exists; |
| 9 | create dataverse test; |
| 10 | use dataverse test; |
ramangrover29 | a321120 | 2013-05-19 11:56:49 -0700 | [diff] [blame] | 11 | set import-private-functions 'true'; |
alexander.behm | c576c60 | 2012-07-06 02:41:15 +0000 | [diff] [blame] | 12 | |
| 13 | create type DBLPType as closed { |
| 14 | id: int32, |
| 15 | dblpid: string, |
| 16 | title: string, |
| 17 | authors: string, |
| 18 | misc: string |
| 19 | } |
| 20 | |
ramangrover29 | 669d8f6 | 2013-02-11 06:03:32 +0000 | [diff] [blame] | 21 | create dataset DBLP(DBLPType) primary key id; |
alexander.behm | c576c60 | 2012-07-06 02:41:15 +0000 | [diff] [blame] | 22 | |
alexander.behm | c576c60 | 2012-07-06 02:41:15 +0000 | [diff] [blame] | 23 | create index ngram_index on DBLP(title) type ngram(3); |
| 24 | |
| 25 | write output to nc1:"rttest/inverted-index-complex_ngram-jaccard-check-let.adm"; |
| 26 | |
| 27 | for $o in dataset('DBLP') |
| 28 | let $jacc := similarity-jaccard-check(gram-tokens($o.title, 3, false), gram-tokens("Transactions for Cooperative Environments", 3, false), 0.5f) |
| 29 | where $jacc[0] |
ramangrover29 | a321120 | 2013-05-19 11:56:49 -0700 | [diff] [blame] | 30 | return $o |