Permalink
Browse files

Adding passing test

  • Loading branch information...
1 parent 9b198b5 commit e3be3947135cb6a19d66a393a81c8e1c5a324003 @ayende ayende committed Jun 23, 2011
Showing with 47 additions and 0 deletions.
  1. +47 −0 Raven.Tests/Bugs/LuceneIndexing.cs
@@ -0,0 +1,47 @@
+using System;
+using Lucene.Net.Analysis;
+using Lucene.Net.Documents;
+using Lucene.Net.Index;
+using Lucene.Net.QueryParsers;
+using Lucene.Net.Search;
+using Lucene.Net.Store;
+using Xunit;
+using Version = Lucene.Net.Util.Version;
+
+namespace Raven.Tests.Bugs
+{
+ public class LuceneIndexing
+ {
+ [Fact]
+ public void MrsJones()
+ {
+ var dir = new RAMDirectory();
+ var analyzer = new WhitespaceAnalyzer();
+ var writer = new IndexWriter(dir, analyzer, true, IndexWriter.MaxFieldLength.UNLIMITED);
+ var document = new Lucene.Net.Documents.Document();
+ document.Add(new Field("Name", "MRS. SHABA", Field.Store.NO, Field.Index.ANALYZED_NO_NORMS));
+ writer.AddDocument(document);
+
+ writer.Close(true);
+
+
+
+ var searcher = new IndexSearcher(dir, true);
+
+ var termEnum = searcher.GetIndexReader().Terms();
+ while (termEnum.Next())
+ {
+ var buffer = termEnum.Term().Text();
+ Console.WriteLine(buffer);
+ }
+
+ var queryParser = new QueryParser(Version.LUCENE_29, "", analyzer);
+ queryParser.SetLowercaseExpandedTerms(false);
+ var query = queryParser.Parse("Name:MRS.*");
+ Console.WriteLine(query);
+ var result = searcher.Search(query, 10);
+
+ Assert.NotEqual(0,result.totalHits);
+ }
+ }
+}

0 comments on commit e3be394

Please sign in to comment.