| * Description : Tests whether an ngram_index is applied to optimize a selection query using the similarity-jaccard-check function on 3-gram tokens. |
| * Tests that the optimizer rule correctly drills through the let clauses. |
| * The index should be applied. |
| drop dataverse test if exists; |
| set import-private-functions 'true'; |
| create type DBLPType as closed { |
| 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-jaccard-check-multi-let.adm"; |
| // This test is complex because we have three assigns to drill into. |
| for $paper in dataset('DBLP') |
| let $paper_tokens := gram-tokens($paper.title, 3, false) |
| let $query_tokens := gram-tokens("Transactions for Cooperative Environments", 3, false) |
| let $jacc := similarity-jaccard-check($paper_tokens, $query_tokens, 0.5f) |
| return {"Paper": $paper_tokens, "Query": $query_tokens } |