Lucene.Net.QueryParsers.TestQueryParser.TestPositionIncrements C# (CSharp) Method

TestPositionIncrements() private method

private TestPositionIncrements ( ) : void
return void
		public virtual void  TestPositionIncrements()
		{
			Directory dir = new MockRAMDirectory();
			Analyzer a = new StandardAnalyzer(Version.LUCENE_CURRENT);
			IndexWriter w = new IndexWriter(dir, a, IndexWriter.MaxFieldLength.UNLIMITED);
			Document doc = new Document();
			doc.Add(new Field("f", "the wizard of ozzy", Field.Store.NO, Field.Index.ANALYZED));
			w.AddDocument(doc);
			IndexReader r = w.GetReader();
			w.Close();
			IndexSearcher s = new IndexSearcher(r);
			QueryParser qp = new QueryParser(Version.LUCENE_CURRENT, "f", a);
			Query q = qp.Parse("\"wizard of ozzy\"");
			Assert.AreEqual(1, s.Search(q, 1).TotalHits);
			r.Close();
			dir.Close();
		}