blob: a506053f3d4c664e2851ffae498a0bbdbc94056c [file] [log] [blame]
/*
* 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.
* Tests that the optimizer rule correctly drills through the substring function.
* The index should be applied.
* Success : Yes
*/
drop dataverse test if exists;
create dataverse test;
use dataverse test;
create type DBLPType as closed {
id: int32,
dblpid: string,
title: string,
authors: string,
misc: string
}
create dataset DBLP(DBLPType) primary key id;
create index ngram_index on DBLP(title) type ngram(3);
write output to nc1:"rttest/inverted-index-complex_ngram-edit-distance-check-substring.adm";
for $paper in dataset('DBLP')
where edit-distance-check(substring($paper.title, 0, 8), "datbase", 1)[0]
return {
"id" : $paper.id,
"title" : $paper.title
}