Пример #1
0
        public virtual void  TestToString()
        {
            StopAnalyzer analyzer = new StopAnalyzer();

            StopFilter.SetEnablePositionIncrementsDefault(true);
            QueryParser qp = new QueryParser("field", analyzer);

            qp.SetEnablePositionIncrements(true);
            PhraseQuery q = (PhraseQuery)qp.Parse("\"this hi this is a test is\"");

            Assert.AreEqual("field:\"? hi ? ? ? test\"", q.ToString());
            q.Add(new Term("field", "hello"), 1);
            Assert.AreEqual("field:\"? hi|hello ? ? ? test\"", q.ToString());
        }