blob: d0d3035f250545f289023fbb7a157c82f3fb6fb2 [file] [log] [blame]
vinayakb5ee049d2013-04-06 21:21:29 +00001/*
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
8drop dataverse test if exists;
9create dataverse test;
10use dataverse test;
11
12create type DBLPType as closed {
13 id: int32,
14 dblpid: string,
15 title: string,
16 authors: string,
17 misc: string
18}
19
20create dataset DBLP(DBLPType) primary key id;
21
22create index ngram_index on DBLP(authors) type ngram(3);
23
24write 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.
27for $o in dataset('DBLP')
28let $ed := edit-distance-check($o.authors, "Amihay Motro", 5)
29where $ed[0]
30return $o