blob: 7dfc9f69e4f912ce26fd90ba25ddbf79ce6d3126 [file] [log] [blame]
alexander.behmc576c602012-07-06 02:41:15 +00001/*
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
8drop dataverse test if exists;
9create dataverse test;
10use dataverse test;
ramangrover29a3211202013-05-19 11:56:49 -070011set import-private-functions 'true';
alexander.behmc576c602012-07-06 02:41:15 +000012
13create type DBLPType as closed {
14 id: int32,
15 dblpid: string,
16 title: string,
17 authors: string,
18 misc: string
19}
20
ramangrover29669d8f62013-02-11 06:03:32 +000021create dataset DBLP(DBLPType) primary key id;
alexander.behmc576c602012-07-06 02:41:15 +000022
alexander.behmc576c602012-07-06 02:41:15 +000023create index ngram_index on DBLP(title) type ngram(3);
24
25write output to nc1:"rttest/inverted-index-complex_ngram-jaccard-check-multi-let.adm";
26
27// This test is complex because we have three assigns to drill into.
28for $paper in dataset('DBLP')
29let $paper_tokens := gram-tokens($paper.title, 3, false)
30let $query_tokens := gram-tokens("Transactions for Cooperative Environments", 3, false)
31let $jacc := similarity-jaccard-check($paper_tokens, $query_tokens, 0.5f)
32where $jacc[0]
ramangrover29a3211202013-05-19 11:56:49 -070033return {"Paper": $paper_tokens, "Query": $query_tokens }