expand() public method

public expand ( Query>.Dictionary flatQueries ) : Query>.Dictionary
flatQueries Query>.Dictionary
return Query>.Dictionary
Exemplo n.º 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"
            HashSet <Query> flatQueries = new 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"));
        }
Exemplo n.º 2
0
        public void TestNoExpand()
        {
            Query      dummy = PqF("DUMMY");
            FieldQuery fq    = new FieldQuery(dummy, true, true);

            // "a b","c d" => "a b","c d"
            HashSet <Query> flatQueries = new 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 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 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 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 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 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"));
        }
Exemplo n.º 3
0
        public void TestExpand()
        {
            Query dummy = PqF("DUMMY");
            FieldQuery fq = new FieldQuery(dummy, true, true);

            // "a b","b c" => "a b","b c","a b c"
            HashSet<Query> flatQueries = new HashSet<Query>();
            flatQueries.Add(PqF("a", "b"));
            flatQueries.Add(PqF( "b", "c" ));
            AssertCollectionQueries(fq.expand(flatQueries),
                PqF("a", "b"), PqF("b", "c"), PqF("a", "b", "c"));

            // "a b","b c d" => "a b","b c d","a b c d"
            flatQueries = new HashSet<Query>();
            flatQueries.Add(PqF("a", "b"));
            flatQueries.Add(PqF("b", "c", "d"));
            AssertCollectionQueries(fq.expand(flatQueries),
                PqF("a", "b"), PqF("b", "c", "d"), PqF("a", "b", "c", "d"));

            // "a b c","b c d" => "a b c","b c d","a b c d"
            flatQueries = new HashSet<Query>();
            flatQueries.Add(PqF("a", "b", "c"));
            flatQueries.Add(PqF("b", "c", "d"));
            AssertCollectionQueries(fq.expand(flatQueries),
                PqF("a", "b", "c"), PqF("b", "c", "d"), PqF("a", "b", "c", "d"));

            // "a b c","c d e" => "a b c","c d e","a b c d e"
            flatQueries = new HashSet<Query>();
            flatQueries.Add(PqF("a", "b", "c"));
            flatQueries.Add(PqF("c", "d", "e"));
            AssertCollectionQueries(fq.expand(flatQueries),
                PqF("a", "b", "c"), PqF("c", "d", "e"), PqF("a", "b", "c", "d", "e"));

            // "a b c d","b c" => "a b c d","b c"
            flatQueries = new HashSet<Query>();
            flatQueries.Add(PqF("a", "b", "c", "d"));
            flatQueries.Add(PqF("b", "c"));
            AssertCollectionQueries(fq.expand(flatQueries),
                PqF("a", "b", "c", "d"), PqF("b", "c"));

            // "a b b","b c" => "a b b","b c","a b b c"
            flatQueries = new HashSet<Query>();
            flatQueries.Add(PqF("a", "b", "b"));
            flatQueries.Add(PqF("b", "c"));
            AssertCollectionQueries(fq.expand(flatQueries),
                PqF("a", "b", "b"), PqF("b", "c"), PqF("a", "b", "b", "c"));

            // "a b","b a" => "a b","b a","a b a", "b a b"
            flatQueries = new HashSet<Query>();
            flatQueries.Add(PqF("a", "b"));
            flatQueries.Add(PqF("b", "a"));
            AssertCollectionQueries(fq.expand(flatQueries),
                PqF("a", "b"), PqF("b", "a"), PqF("a", "b", "a"), PqF("b", "a", "b"));

            // "a b","a b c" => "a b","a b c"
            flatQueries = new HashSet<Query>();
            flatQueries.Add(PqF("a", "b"));
            flatQueries.Add(PqF("a", "b", "c"));
            AssertCollectionQueries(fq.expand(flatQueries),
                PqF("a", "b"), PqF("a", "b", "c"));
        }
Exemplo n.º 4
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"
            HashSet<Query> flatQueries = new 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"));
        }