fixed issue 731, 740, and more.

commit 0b46141bea8d503896dc06308f102131df2e4f3d
Author: Young-Seok <kisskys@gmail.com>
Date:   Tue May 20 12:52:54 2014 -0700

    fixed issues of access method rules that try to use incompatible indexes and similarity functions

commit a0ea4e411503de265f1883aa3837a45be4a8747a
Merge: bb8fe91 b5785a9
Author: Young-Seok <kisskys@gmail.com>
Date:   Sun May 18 13:00:33 2014 -0700

    merged from master branch to kisskys/left-outer-join-issue branch

commit bb8fe91ffd4fec3d495d32442020447693be8548
Author: Young-Seok <kisskys@gmail.com>
Date:   Sun May 18 11:33:54 2014 -0700

    another fix for picking available index for leftouterjoin plan

commit 60b057ecec6a157e3e11cb316ef7d38601483741
Merge: a743e44 6cb7fd9
Author: Young-Seok <kisskys@gmail.com>
Date:   Sun May 11 22:22:42 2014 -0700

    merged master to kisskys/left-outer-join-issue branch

commit a743e4493f0f84f7a71e671478592d487e7510e3
Author: Young-Seok <kisskys@gmail.com>
Date:   Sun May 11 20:51:50 2014 -0700

    changes for left-outer-join to pick available indexes

Change-Id: I0d89d20c6cc076f40d1fbc5687f0b70e49a91eed
Reviewed-on: http://fulliautomatix.ics.uci.edu:8443/33
Reviewed-by: Inci Cetindil <icetindil@gmail.com>
Tested-by: Ian Maxon <imaxon@uci.edu>
diff --git a/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ngram-contains.aql b/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ngram-contains.aql
new file mode 100644
index 0000000..676ed3b
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ngram-contains.aql
@@ -0,0 +1,47 @@
+/*
+ * Description    : Tests whether an ngram_index is applied to optimize a join query using the contains 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-join_ngram-contains.adm";
+
+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-join_ngram-contains.adm";
+
+for $o1 in dataset('DBLP')
+for $o2 in dataset('DBLP')
+where contains($o1.title, $o2.title) and $o1.id < $o2.id
+order by $o1.id, $o2.id
+return {"title1":$o1.title, "title2":$o2.title}
\ No newline at end of file