Esempio n. 1
0
        public void TestFlatten1TermPhrase()
        {
            Query        query       = pqF("A");
            FieldQuery   fq          = new FieldQuery(query, true, true);
            ISet <Query> flatQueries = new JCG.HashSet <Query>();

            fq.Flatten(query, reader, flatQueries);
            assertCollectionQueries(flatQueries, tq("A"));
        }
Esempio n. 2
0
        public void TestFlattenDisjunctionMaxQuery()
        {
            initBoost();
            Query query = dmq(tq("A"), tq("B"), pqF("C", "D"));

            query.Boost = (boost);
            FieldQuery   fq          = new FieldQuery(query, true, true);
            ISet <Query> flatQueries = new JCG.HashSet <Query>();

            fq.Flatten(query, reader, flatQueries);
            assertCollectionQueries(flatQueries, tq(boost, "A"), tq(boost, "B"), pqF(boost, "C", "D"));
        }
Esempio n. 3
0
        public void TestFlattenConstantScoreQuery()
        {
            initBoost();
            Query query = new ConstantScoreQuery(pqF("A"));

            query.Boost = (boost);
            FieldQuery   fq          = new FieldQuery(query, true, true);
            ISet <Query> flatQueries = new JCG.HashSet <Query>();

            fq.Flatten(query, reader, flatQueries);
            assertCollectionQueries(flatQueries, tq(boost, "A"));
        }
Esempio n. 4
0
        public void TestFlattenFilteredQuery()
        {
            initBoost();
            Query query = new FilteredQuery(pqF("A"), new TestFlattenFilteredQueryFilterAnonymousHelper());

            query.Boost = (boost);
            FieldQuery   fq          = new FieldQuery(query, true, true);
            ISet <Query> flatQueries = new JCG.HashSet <Query>();

            fq.Flatten(query, reader, flatQueries);
            assertCollectionQueries(flatQueries, tq(boost, "A"));
        }
Esempio n. 5
0
        public void TestFlattenTermAndPhrase2gram()
        {
            BooleanQuery query = new BooleanQuery();

            query.Add(new TermQuery(new Term(F, "AA")), Occur.MUST);
            query.Add(toPhraseQuery(analyze("BCD", F, analyzerB), F), Occur.MUST);
            query.Add(toPhraseQuery(analyze("EFGH", F, analyzerB), F), Occur.SHOULD);

            FieldQuery   fq          = new FieldQuery(query, true, true);
            ISet <Query> flatQueries = new JCG.HashSet <Query>();

            fq.Flatten(query, reader, flatQueries);
            assertCollectionQueries(flatQueries, tq("AA"), pqF("BC", "CD"), pqF("EF", "FG", "GH"));
        }
Esempio n. 6
0
        public void TestFlattenTermAndPhrase()
        {
            initBoost();
            BooleanQuery booleanQuery = new BooleanQuery();

            booleanQuery.Boost = (boost);
            booleanQuery.Add(tq("A"), Occur.MUST);
            booleanQuery.Add(pqF("B", "C"), Occur.MUST);

            FieldQuery   fq          = new FieldQuery(booleanQuery, true, true);
            ISet <Query> flatQueries = new JCG.HashSet <Query>();

            fq.Flatten(booleanQuery, reader, flatQueries);
            assertCollectionQueries(flatQueries, tq(boost, "A"), pqF(boost, "B", "C"));
        }
Esempio n. 7
0
        public void TestFlattenBoolean()
        {
            initBoost();
            BooleanQuery booleanQuery = new BooleanQuery();

            booleanQuery.Boost = (boost);
            booleanQuery.Add(tq("A"), Occur.MUST);
            booleanQuery.Add(tq("B"), Occur.MUST);
            booleanQuery.Add(tq("C"), Occur.SHOULD);

            BooleanQuery innerQuery = new BooleanQuery();

            innerQuery.Add(tq("D"), Occur.MUST);
            innerQuery.Add(tq("E"), Occur.MUST);
            booleanQuery.Add(innerQuery, Occur.MUST_NOT);

            FieldQuery   fq          = new FieldQuery(booleanQuery, true, true);
            ISet <Query> flatQueries = new JCG.HashSet <Query>();

            fq.Flatten(booleanQuery, reader, flatQueries);
            assertCollectionQueries(flatQueries, tq(boost, "A"), tq(boost, "B"), tq(boost, "C"));
        }