Example #1
0
        private IList<Query> BuildQueries()
        {
            IList<Query> queries = new List<Query>();

            BooleanQuery booleanAB = new BooleanQuery();
            booleanAB.add(new TermQuery(new Term("contents", "a")), BooleanClause.Occur_e.SHOULD);
            booleanAB.add(new TermQuery(new Term("contents", "b")), BooleanClause.Occur_e.SHOULD);
            queries.Add(booleanAB);

            PhraseQuery phraseAB = new PhraseQuery();
            phraseAB.add(new Term("contents", "a"));
            phraseAB.add(new Term("contents", "b"));
            queries.Add(phraseAB);

            PhraseQuery phraseABC = new PhraseQuery();
            phraseABC.add(new Term("contents", "a"));
            phraseABC.add(new Term("contents", "b"));
            phraseABC.add(new Term("contents", "c"));
            queries.Add(phraseABC);

            BooleanQuery booleanAC = new BooleanQuery();
            booleanAC.add(new TermQuery(new Term("contents", "a")), BooleanClause.Occur_e.SHOULD);
            booleanAC.add(new TermQuery(new Term("contents", "c")), BooleanClause.Occur_e.SHOULD);
            queries.Add(booleanAC);

            PhraseQuery phraseAC = new PhraseQuery();
            phraseAC.add(new Term("contents", "a"));
            phraseAC.add(new Term("contents", "c"));
            queries.Add(phraseAC);

            PhraseQuery phraseACE = new PhraseQuery();
            phraseACE.add(new Term("contents", "a"));
            phraseACE.add(new Term("contents", "c"));
            phraseACE.add(new Term("contents", "e"));
            queries.Add(phraseACE);

            return queries;
        }