Beispiel #1
0
        public void TestExpandNotFieldMatch()
        {
            Query      dummy = pqF("DUMMY");
            FieldQuery fq    = new FieldQuery(dummy, true, false);

            // f1:"a b",f2:"b c" => f1:"a b",f2:"b c",f1:"a b c"
            ISet <Query> flatQueries = new JCG.HashSet <Query>();

            flatQueries.Add(pq(F1, "a", "b"));
            flatQueries.Add(pq(F2, "b", "c"));
            assertCollectionQueries(fq.Expand(flatQueries),
                                    pq(F1, "a", "b"), pq(F2, "b", "c"), pq(F1, "a", "b", "c"));
        }
Beispiel #2
0
        public void TestNoExpand()
        {
            Query      dummy = pqF("DUMMY");
            FieldQuery fq    = new FieldQuery(dummy, true, true);

            // "a b","c d" => "a b","c d"
            ISet <Query> flatQueries = new JCG.HashSet <Query>();

            flatQueries.Add(pqF("a", "b"));
            flatQueries.Add(pqF("c", "d"));
            assertCollectionQueries(fq.Expand(flatQueries),
                                    pqF("a", "b"), pqF("c", "d"));

            // "a","a b" => "a", "a b"
            flatQueries = new JCG.HashSet <Query>();
            flatQueries.Add(tq("a"));
            flatQueries.Add(pqF("a", "b"));
            assertCollectionQueries(fq.Expand(flatQueries),
                                    tq("a"), pqF("a", "b"));

            // "a b","b" => "a b", "b"
            flatQueries = new JCG.HashSet <Query>();
            flatQueries.Add(pqF("a", "b"));
            flatQueries.Add(tq("b"));
            assertCollectionQueries(fq.Expand(flatQueries),
                                    pqF("a", "b"), tq("b"));

            // "a b c","b c" => "a b c","b c"
            flatQueries = new JCG.HashSet <Query>();
            flatQueries.Add(pqF("a", "b", "c"));
            flatQueries.Add(pqF("b", "c"));
            assertCollectionQueries(fq.Expand(flatQueries),
                                    pqF("a", "b", "c"), pqF("b", "c"));

            // "a b","a b c" => "a b","a b c"
            flatQueries = new JCG.HashSet <Query>();
            flatQueries.Add(pqF("a", "b"));
            flatQueries.Add(pqF("a", "b", "c"));
            assertCollectionQueries(fq.Expand(flatQueries),
                                    pqF("a", "b"), pqF("a", "b", "c"));

            // "a b c","b d e" => "a b c","b d e"
            flatQueries = new JCG.HashSet <Query>();
            flatQueries.Add(pqF("a", "b", "c"));
            flatQueries.Add(pqF("b", "d", "e"));
            assertCollectionQueries(fq.Expand(flatQueries),
                                    pqF("a", "b", "c"), pqF("b", "d", "e"));
        }