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