Ejemplo n.º 1
0
        void TestR7_2()
        {
            Write("\n ---Query for keys matching a specific pattern ---");
            Write("\n return all keys which contain string \"key\"");
            QueryEngine <string, List <string> > query2 = new QueryEngine <string, List <string> >(DBListOfString);
            List <string>       result;
            Func <string, bool> defineQuery = query2.defineSpecPatternQuery();

            query2.processQuery(defineQuery, out result);
            foreach (var r in result)
            {
                Write("\n key: {0}", r.ToString());
            }
            WriteLine();
            Write("\n ---Query keys contains a specific string in metadata ---");
            Write("\n return all keys that contains \"elemLos2\" in its metadata");
            defineQuery = query2.defineStringQuery("elemLos2");
            query2.processQuery(defineQuery, out result);
            foreach (var r in result)
            {
                Write("\n key: {0}", r.ToString());
            }
            WriteLine();
            Write("\n ---Query for values written within a specific time interval---");
            Write("\n Query for value written between 10/1/2015 00:00:00 and 10/2/2015 11:00:00");
            DateTime time1 = new DateTime(2015, 10, 1, 0, 0, 0);
            DateTime time2 = new DateTime(2015, 10, 2, 11, 0, 0);

            defineQuery = query2.defineTimeQuery(time1, time2);
            query2.processQuery(defineQuery, out result);
            foreach (var r in result)
            {
                Write("\n key: {0}", r.ToString());
            }
        }