blob: a506053f3d4c664e2851ffae498a0bbdbc94056c [file] [log] [blame]
icetindila62f7522014-04-18 18:16:20 -07001/*
2 * Description : Tests whether an ngram_index index is applied to optimize a selection query using the similarity-edit-distance-check function on the substring of the field.
3 * Tests that the optimizer rule correctly drills through the substring function.
4 * The index should be applied.
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(title) type ngram(3);
23
24write output to nc1:"rttest/inverted-index-complex_ngram-edit-distance-check-substring.adm";
25
26for $paper in dataset('DBLP')
27where edit-distance-check(substring($paper.title, 0, 8), "datbase", 1)[0]
28return {
29 "id" : $paper.id,
30 "title" : $paper.title
31}