lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aro...@apache.org
Subject svn commit: r432239 [7/8] - in /incubator/lucene.net/trunk/C#/src: ./ Demo/DeleteFiles/ Demo/DemoLib/ Demo/DemoLib/HTML/ Demo/IndexFiles/ Demo/IndexHtml/ Demo/SearchFiles/ Lucene.Net/ Lucene.Net/Analysis/ Lucene.Net/Analysis/Standard/ Lucene.Net/Docume...
Date Thu, 17 Aug 2006 13:49:32 GMT
Modified: incubator/lucene.net/trunk/C#/src/Test/QueryParser/TestMultiFieldQueryParser.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/QueryParser/TestMultiFieldQueryParser.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/QueryParser/TestMultiFieldQueryParser.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/QueryParser/TestMultiFieldQueryParser.cs Thu Aug 17 06:49:26 2006
@@ -99,27 +99,6 @@
 			Assert.AreEqual("+(b:\"aa bb cc\" t:\"aa bb cc\") +(b:\"dd ee\" t:\"dd ee\")", q.ToString());
 		}
 		
-		// TODO: remove this for Lucene 2.0
-		[Test]
-        public virtual void  TestOldMethods()
-		{
-			// testing the old static calls that are now deprecated:
-			AssertQueryEquals("b:one t:one", "one");
-			AssertQueryEquals("(b:one b:two) (t:one t:two)", "one two");
-			AssertQueryEquals("(b:one -b:two) (t:one -t:two)", "one -two");
-			AssertQueryEquals("(b:one -(b:two b:three)) (t:one -(t:two t:three))", "one -(two three)");
-			AssertQueryEquals("(+b:one +b:two) (+t:one +t:two)", "+one +two");
-		}
-		
-		// TODO: remove this for Lucene 2.0
-		private void  AssertQueryEquals(System.String expected, System.String query)
-		{
-			System.String[] fields = new System.String[]{"b", "t"};
-			Query q = MultiFieldQueryParser.Parse(query, fields, new StandardAnalyzer());
-			System.String s = q.ToString();
-			Assert.AreEqual(expected, s);
-		}
-		
 		[Test]
         public virtual void  TestStaticMethod1()
 		{
@@ -178,25 +157,28 @@
 		[Test]
         public virtual void  TestStaticMethod2Old()
 		{
-			System.String[] fields = new System.String[]{"b", "t"};
-			int[] flags = new int[]{MultiFieldQueryParser.REQUIRED_FIELD, MultiFieldQueryParser.PROHIBITED_FIELD};
-			Query q = MultiFieldQueryParser.Parse("one", fields, flags, new StandardAnalyzer());
-			Assert.AreEqual("+b:one -t:one", q.ToString());
-			
-			q = MultiFieldQueryParser.Parse("one two", fields, flags, new StandardAnalyzer());
-			Assert.AreEqual("+(b:one b:two) -(t:one t:two)", q.ToString());
-			
-			try
-			{
-				int[] flags2 = new int[]{MultiFieldQueryParser.REQUIRED_FIELD};
-				q = MultiFieldQueryParser.Parse("blah", fields, flags2, new StandardAnalyzer());
-				Assert.Fail();
-			}
-			catch (System.ArgumentException e)
-			{
-				// expected exception, array length differs
-			}
-		}
+            System.String[] fields = new System.String[]{"b", "t"};
+            //int[] flags = {MultiFieldQueryParser.REQUIRED_FIELD, MultiFieldQueryParser.PROHIBITED_FIELD};
+            BooleanClause.Occur[] flags = new BooleanClause.Occur[]{BooleanClause.Occur.MUST, BooleanClause.Occur.MUST_NOT};
+            MultiFieldQueryParser parser = new MultiFieldQueryParser(fields, new StandardAnalyzer());
+			
+            Query q = MultiFieldQueryParser.Parse("one", fields, flags, new StandardAnalyzer()); //, fields, flags, new StandardAnalyzer());
+            Assert.AreEqual("+b:one -t:one", q.ToString());
+			
+            q = MultiFieldQueryParser.Parse("one two", fields, flags, new StandardAnalyzer());
+            Assert.AreEqual("+(b:one b:two) -(t:one t:two)", q.ToString());
+			
+            try
+            {
+                BooleanClause.Occur[] flags2 = new BooleanClause.Occur[]{BooleanClause.Occur.MUST};
+                q = MultiFieldQueryParser.Parse("blah", fields, flags2, new StandardAnalyzer());
+                Assert.Fail();
+            }
+            catch (System.ArgumentException e)
+            {
+                // expected exception, array length differs
+            }
+        }
 		
 		[Test]
         public virtual void  TestStaticMethod3()
@@ -222,23 +204,23 @@
 		[Test]
         public virtual void  TestStaticMethod3Old()
 		{
-			System.String[] queries = new System.String[]{"one", "two"};
-			System.String[] fields = new System.String[]{"b", "t"};
-			int[] flags = new int[]{MultiFieldQueryParser.REQUIRED_FIELD, MultiFieldQueryParser.PROHIBITED_FIELD};
-			Query q = MultiFieldQueryParser.Parse(queries, fields, flags, new StandardAnalyzer());
-			Assert.AreEqual("+b:one -t:two", q.ToString());
-			
-			try
-			{
-				int[] flags2 = new int[]{MultiFieldQueryParser.REQUIRED_FIELD};
-				q = MultiFieldQueryParser.Parse(queries, fields, flags2, new StandardAnalyzer());
-				Assert.Fail();
-			}
-			catch (System.ArgumentException e)
-			{
-				// expected exception, array length differs
-			}
-		}
+            System.String[] queries = new System.String[]{"one", "two"};
+            System.String[] fields = new System.String[]{"b", "t"};
+            BooleanClause.Occur[] flags = new BooleanClause.Occur[]{BooleanClause.Occur.MUST, BooleanClause.Occur.MUST_NOT};
+            Query q = MultiFieldQueryParser.Parse(queries, fields, flags, new StandardAnalyzer());
+            Assert.AreEqual("+b:one -t:two", q.ToString());
+			
+            try
+            {
+                BooleanClause.Occur[] flags2 = new BooleanClause.Occur[]{BooleanClause.Occur.MUST};
+                q = MultiFieldQueryParser.Parse(queries, fields, flags2, new StandardAnalyzer());
+                Assert.Fail();
+            }
+            catch (System.ArgumentException e)
+            {
+                // expected exception, array length differs
+            }
+        }
 		
 		[Test]
         public virtual void  TestAnalyzerReturningNull()

Modified: incubator/lucene.net/trunk/C#/src/Test/QueryParser/TestQueryParser.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/QueryParser/TestQueryParser.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/QueryParser/TestQueryParser.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/QueryParser/TestQueryParser.cs Thu Aug 17 06:49:26 2006
@@ -141,7 +141,16 @@
 			}
 		}
 		
-		public virtual void  AssertWildcardQueryEquals(System.String query, bool lowercase, System.String result)
+        public virtual void  AssertEscapedQueryEquals(System.String query, Analyzer a, System.String result)
+        {
+            System.String escapedQuery = Lucene.Net.QueryParsers.QueryParser.Escape(query);
+            if (!escapedQuery.Equals(result))
+            {
+                Assert.Fail("Query /" + query + "/ yielded /" + escapedQuery + "/, expecting /" + result + "/");
+            }
+        }
+		
+        public virtual void  AssertWildcardQueryEquals(System.String query, bool lowercase, System.String result)
 		{
 			Lucene.Net.QueryParsers.QueryParser qp = GetParser(null);
 			qp.SetLowercaseExpandedTerms(lowercase);
@@ -447,7 +456,44 @@
 			AssertQueryEquals("[ a\\\\ TO a\\* ]", null, "[a\\ TO a*]");
 		}
 		
-		[Test]
+        [Test]
+        public virtual void  TestQueryStringEscaping()
+        {
+            Analyzer a = new WhitespaceAnalyzer();
+			
+            AssertEscapedQueryEquals("a-b:c", a, "a\\-b\\:c");
+            AssertEscapedQueryEquals("a+b:c", a, "a\\+b\\:c");
+            AssertEscapedQueryEquals("a:b:c", a, "a\\:b\\:c");
+            AssertEscapedQueryEquals("a\\b:c", a, "a\\\\b\\:c");
+			
+            AssertEscapedQueryEquals("a:b-c", a, "a\\:b\\-c");
+            AssertEscapedQueryEquals("a:b+c", a, "a\\:b\\+c");
+            AssertEscapedQueryEquals("a:b:c", a, "a\\:b\\:c");
+            AssertEscapedQueryEquals("a:b\\c", a, "a\\:b\\\\c");
+			
+            AssertEscapedQueryEquals("a:b-c*", a, "a\\:b\\-c\\*");
+            AssertEscapedQueryEquals("a:b+c*", a, "a\\:b\\+c\\*");
+            AssertEscapedQueryEquals("a:b:c*", a, "a\\:b\\:c\\*");
+			
+            AssertEscapedQueryEquals("a:b\\\\c*", a, "a\\:b\\\\\\\\c\\*");
+			
+            AssertEscapedQueryEquals("a:b-?c", a, "a\\:b\\-\\?c");
+            AssertEscapedQueryEquals("a:b+?c", a, "a\\:b\\+\\?c");
+            AssertEscapedQueryEquals("a:b:?c", a, "a\\:b\\:\\?c");
+			
+            AssertEscapedQueryEquals("a:b?c", a, "a\\:b\\?c");
+			
+            AssertEscapedQueryEquals("a:b-c~", a, "a\\:b\\-c\\~");
+            AssertEscapedQueryEquals("a:b+c~", a, "a\\:b\\+c\\~");
+            AssertEscapedQueryEquals("a:b:c~", a, "a\\:b\\:c\\~");
+            AssertEscapedQueryEquals("a:b\\c~", a, "a\\:b\\\\c\\~");
+			
+            AssertEscapedQueryEquals("[ a - TO a+ ]", null, "\\[ a \\- TO a\\+ \\]");
+            AssertEscapedQueryEquals("[ a : TO a~ ]", null, "\\[ a \\: TO a\\~ \\]");
+            AssertEscapedQueryEquals("[ a\\ TO a* ]", null, "\\[ a\\\\ TO a\\* \\]");
+        }
+		
+        [Test]
         public virtual void  TestTabNewlineCarriageReturn()
 		{
 			AssertQueryEqualsDOA("+weltbank +worlbank", null, "+weltbank +worlbank");
@@ -571,7 +617,43 @@
 			Assert.AreEqual(query1, query2);
 		}
 		
-		[TearDown]
+        [Test]
+        public virtual void  TestLocalDateFormat()
+        {
+            Lucene.Net.Store.RAMDirectory ramDir = new Lucene.Net.Store.RAMDirectory();
+            Lucene.Net.Index.IndexWriter iw = new Lucene.Net.Index.IndexWriter(ramDir, new WhitespaceAnalyzer(), true);
+            AddDateDoc("a", 2005, 12, 2, 10, 15, 33, iw);
+            AddDateDoc("b", 2005, 12, 4, 22, 15, 0, iw);
+            iw.Close();
+            Lucene.Net.Search.IndexSearcher is_Renamed = new Lucene.Net.Search.IndexSearcher(ramDir);
+            AssertHits(1, "[12/1/2005 TO 12/3/2005]", is_Renamed);
+            AssertHits(2, "[12/1/2005 TO 12/4/2005]", is_Renamed);
+            AssertHits(1, "[12/3/2005 TO 12/4/2005]", is_Renamed);
+            AssertHits(1, "{12/1/2005 TO 12/3/2005}", is_Renamed);
+            AssertHits(1, "{12/1/2005 TO 12/4/2005}", is_Renamed);
+            AssertHits(0, "{12/3/2005 TO 12/4/2005}", is_Renamed);
+            is_Renamed.Close();
+        }
+		
+        private void  AssertHits(int expected, System.String query, Lucene.Net.Search.IndexSearcher is_Renamed)
+        {
+            Lucene.Net.QueryParsers.QueryParser qp = new Lucene.Net.QueryParsers.QueryParser("date", new WhitespaceAnalyzer());
+            qp.SetLocale(new System.Globalization.CultureInfo("en"));
+            Query q = qp.Parse(query);
+            Lucene.Net.Search.Hits hits = is_Renamed.Search(q);
+            Assert.AreEqual(expected, hits.Length());
+        }
+		
+        private static void  AddDateDoc(System.String content, int year, int month, int day, int hour, int minute, int second, Lucene.Net.Index.IndexWriter iw)
+        {
+            Lucene.Net.Documents.Document d = new Lucene.Net.Documents.Document();
+            d.Add(new Lucene.Net.Documents.Field("f", content, Lucene.Net.Documents.Field.Store.YES, Lucene.Net.Documents.Field.Index.TOKENIZED));
+            System.DateTime tempAux = new System.DateTime(year, month - 1, day, hour, minute, second);
+            d.Add(new Lucene.Net.Documents.Field("date", DateField.DateToString(tempAux), Lucene.Net.Documents.Field.Store.YES, Lucene.Net.Documents.Field.Index.UN_TOKENIZED));
+            iw.AddDocument(d);
+        }
+		
+        [TearDown]
 		public virtual void  TearDown()
 		{
 			BooleanQuery.SetMaxClauseCount(originalMaxClauses);

Added: incubator/lucene.net/trunk/C#/src/Test/Search/Regex/_delete_TestRegexQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Search/Regex/_delete_TestRegexQuery.cs?rev=432239&view=auto
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Search/Regex/_delete_TestRegexQuery.cs (added)
+++ incubator/lucene.net/trunk/C#/src/Test/Search/Regex/_delete_TestRegexQuery.cs Thu Aug 17 06:49:26 2006
@@ -0,0 +1,138 @@
+/*
+ * Copyright 2005 The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using NUnit.Framework;
+using SimpleAnalyzer = Lucene.Net.Analysis.SimpleAnalyzer;
+using Document = Lucene.Net.Documents.Document;
+using Field = Lucene.Net.Documents.Field;
+using IndexWriter = Lucene.Net.Index.IndexWriter;
+using Term = Lucene.Net.Index.Term;
+using IndexSearcher = Lucene.Net.Search.IndexSearcher;
+using Query = Lucene.Net.Search.Query;
+using SpanNearQuery = Lucene.Net.Search.Spans.SpanNearQuery;
+using SpanQuery = Lucene.Net.Search.Spans.SpanQuery;
+using RAMDirectory = Lucene.Net.Store.RAMDirectory;
+
+namespace Lucene.Net.Search.Regex
+{
+#if DELETE_ME
+	[TestFixture]
+	public class TestRegexQuery
+	{
+		private IndexSearcher searcher;
+		private System.String FN = "field";
+		
+
+        [STAThread]
+        public static void  Main(System.String[] args)
+        {
+            TestRegexQuery t = new TestRegexQuery();
+            t.SetUp();
+            t.TestRegex1();
+        }
+
+		[SetUp]
+        public virtual void  SetUp()
+		{
+			RAMDirectory directory = new RAMDirectory();
+			try
+			{
+				IndexWriter writer = new IndexWriter(directory, new SimpleAnalyzer(), true);
+				Lucene.Net.Documents.Document doc = new Lucene.Net.Documents.Document();
+				doc.Add(new Field(FN, "the quick brown fox jumps over the lazy dog", Field.Store.NO, Field.Index.TOKENIZED));
+				writer.AddDocument(doc);
+				writer.Optimize();
+				writer.Close();
+				searcher = new IndexSearcher(directory);
+			}
+			catch (System.Exception e)
+			{
+				Assert.Fail(e.ToString());
+			}
+		}
+		
+		[TearDown]
+        public virtual void  TearDown()
+		{
+			try
+			{
+				searcher.Close();
+			}
+			catch (System.Exception e)
+			{
+				Assert.Fail(e.ToString());
+			}
+		}
+		
+		private Term NewTerm(System.String value_Renamed)
+		{
+			return new Term(FN, value_Renamed);
+		}
+		
+		private int RegexQueryNrHits(System.String regex)
+		{
+			Query query = new RegexQuery(NewTerm(regex));
+			return searcher.Search(query).Length();
+		}
+		
+		private int SpanRegexQueryNrHits(System.String regex1, System.String regex2, int slop, bool ordered)
+		{
+			SpanRegexQuery srq1 = new SpanRegexQuery(NewTerm(regex1));
+			SpanRegexQuery srq2 = new SpanRegexQuery(NewTerm(regex2));
+			SpanNearQuery query = new SpanNearQuery(new SpanQuery[]{srq1, srq2}, slop, ordered);
+			return searcher.Search(query).Length();
+		}
+		
+		[Test]
+        public virtual void  TestRegex1()
+		{
+			Assert.AreEqual(1, RegexQueryNrHits("q.[aeiou]c.*"));
+		}
+		
+		[Test]
+        public virtual void  TestRegex2()
+		{
+			Assert.AreEqual(0, RegexQueryNrHits("^.[aeiou]c.*"));
+		}
+		
+		[Test]
+        public virtual void  TestRegex3()
+		{
+			Assert.AreEqual(0, RegexQueryNrHits("^q.[aeiou]c$"));
+		}
+		
+		[Test]
+        public virtual void  TestSpanRegex1()
+		{
+			Assert.AreEqual(1, SpanRegexQueryNrHits("q.[aeiou]c.*", "dog", 6, true));
+		}
+		
+		[Test]
+        public virtual void  TestSpanRegex2()
+		{
+			Assert.AreEqual(0, SpanRegexQueryNrHits("q.[aeiou]c.*", "dog", 5, true));
+		}
+		
+		//  public void testPrefix() throws Exception {
+		// This test currently fails because RegexTermEnum picks "r" as the prefix
+		// but the following "?" makes the "r" optional and should be a hit for the
+		// document matching "over".
+		//    Assert.AreEqual(1, regexQueryNrHits("r?over"));
+		//  }
+	}
+#endif
+}
\ No newline at end of file

Added: incubator/lucene.net/trunk/C#/src/Test/Search/Regex/_delete_TestSpanRegexQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Search/Regex/_delete_TestSpanRegexQuery.cs?rev=432239&view=auto
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Search/Regex/_delete_TestSpanRegexQuery.cs (added)
+++ incubator/lucene.net/trunk/C#/src/Test/Search/Regex/_delete_TestSpanRegexQuery.cs Thu Aug 17 06:49:26 2006
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using NUnit.Framework;
+using SimpleAnalyzer = Lucene.Net.Analysis.SimpleAnalyzer;
+using Document = Lucene.Net.Documents.Document;
+using Field = Lucene.Net.Documents.Field;
+using IndexWriter = Lucene.Net.Index.IndexWriter;
+using Term = Lucene.Net.Index.Term;
+using Hits = Lucene.Net.Search.Hits;
+using IndexSearcher = Lucene.Net.Search.IndexSearcher;
+using SpanNearQuery = Lucene.Net.Search.Spans.SpanNearQuery;
+using SpanQuery = Lucene.Net.Search.Spans.SpanQuery;
+using SpanTermQuery = Lucene.Net.Search.Spans.SpanTermQuery;
+using RAMDirectory = Lucene.Net.Store.RAMDirectory;
+
+namespace Lucene.Net.Search.Regex
+{
+#if DELETE_ME
+	[TestFixture]
+	public class TestSpanRegexQuery
+	{
+		[Test]
+        public virtual void  TestSpanRegex()
+		{
+			RAMDirectory directory = new RAMDirectory();
+			IndexWriter writer = new IndexWriter(directory, new SimpleAnalyzer(), true);
+			Lucene.Net.Documents.Document doc = new Lucene.Net.Documents.Document();
+			doc.Add(new Field("field", "the quick brown fox jumps over the lazy dog", Field.Store.NO, Field.Index.TOKENIZED));
+			writer.AddDocument(doc);
+			writer.Optimize();
+			writer.Close();
+			
+			IndexSearcher searcher = new IndexSearcher(directory);
+			SpanRegexQuery srq = new SpanRegexQuery(new Term("field", "q.[aeiou]c.*"));
+			SpanTermQuery stq = new SpanTermQuery(new Term("field", "dog"));
+			SpanNearQuery query = new SpanNearQuery(new SpanQuery[]{srq, stq}, 6, true);
+			Hits hits = searcher.Search(query);
+			Assert.AreEqual(1, hits.Length());
+		}
+	}
+#endif
+}
\ No newline at end of file

Modified: incubator/lucene.net/trunk/C#/src/Test/Search/SampleComparable.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Search/SampleComparable.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Search/SampleComparable.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Search/SampleComparable.cs Thu Aug 17 06:49:26 2006
@@ -171,6 +171,16 @@
 				return new SampleComparable(termtext);
 			}
 		}
+
+        public static SortComparatorSource GetComparatorSource()
+        {
+            return new AnonymousClassSortComparatorSource();
+        }
+
+        public static SortComparator GetComparator()
+        {
+            return new AnonymousClassSortComparator();
+        }
 		
 		internal System.String string_part;
 		internal System.Int32 int_part;
@@ -191,16 +201,6 @@
 				return int_part.CompareTo(otherid.int_part);
 			}
 			return i;
-		}
-		
-		public static SortComparatorSource GetComparatorSource()
-		{
-			return new AnonymousClassSortComparatorSource();
-		}
-		
-		public static SortComparator GetComparator()
-		{
-			return new AnonymousClassSortComparator();
 		}
 	}
 }

Added: incubator/lucene.net/trunk/C#/src/Test/Search/SingleDocTestFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Search/SingleDocTestFilter.cs?rev=432239&view=auto
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Search/SingleDocTestFilter.cs (added)
+++ incubator/lucene.net/trunk/C#/src/Test/Search/SingleDocTestFilter.cs Thu Aug 17 06:49:26 2006
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2006 The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using IndexReader = Lucene.Net.Index.IndexReader;
+
+namespace Lucene.Net.search
+{
+	
+    [Serializable]
+    public class SingleDocTestFilter : Lucene.Net.Search.Filter
+    {
+        private int doc;
+		
+        public SingleDocTestFilter(int doc)
+        {
+            this.doc = doc;
+        }
+		
+        public override System.Collections.BitArray Bits(IndexReader reader)
+        {
+            System.Collections.BitArray bits = new System.Collections.BitArray((reader.MaxDoc() % 64 == 0 ? reader.MaxDoc() / 64 : reader.MaxDoc() / 64 + 1) * 64);
+
+            for (int increment = 0; doc >= bits.Length; increment =+ 64)
+            {
+                bits.Length += increment;
+            }
+            bits.Set(doc, true);
+            
+            return bits;
+        }
+    }
+}
\ No newline at end of file

Modified: incubator/lucene.net/trunk/C#/src/Test/Search/Spans/TestBasics.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Search/Spans/TestBasics.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Search/Spans/TestBasics.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Search/Spans/TestBasics.cs Thu Aug 17 06:49:26 2006
@@ -125,7 +125,11 @@
 			
 			Assert.IsTrue(searcher.Explain(query, 77).GetValue() > 0.0f);
 			Assert.IsTrue(searcher.Explain(query, 977).GetValue() > 0.0f);
-		}
+			
+            QueryUtils.Check(term1);
+            QueryUtils.Check(term2);
+            QueryUtils.CheckUnequal(term1, term2);
+        }
 		
 		[Test]
         public virtual void  TestSpanNearUnordered()
@@ -161,7 +165,80 @@
 			Assert.IsTrue(searcher.Explain(query, 891).GetValue() > 0.0f);
 		}
 		
-		[Test]
+        [Test]
+        public virtual void  TestSpanWithMultipleNotSingle()
+        {
+            SpanTermQuery term1 = new SpanTermQuery(new Term("field", "eight"));
+            SpanTermQuery term2 = new SpanTermQuery(new Term("field", "one"));
+            SpanNearQuery near = new SpanNearQuery(new SpanQuery[]{term1, term2}, 4, true);
+            SpanTermQuery term3 = new SpanTermQuery(new Term("field", "forty"));
+			
+            SpanOrQuery or = new SpanOrQuery(new SpanQuery[]{term3});
+			
+            SpanNotQuery query = new SpanNotQuery(near, or);
+			
+            CheckHits(query, new int[]{801, 821, 831, 851, 861, 871, 881, 891});
+			
+            Assert.IsTrue(searcher.Explain(query, 801).GetValue() > 0.0f);
+            Assert.IsTrue(searcher.Explain(query, 891).GetValue() > 0.0f);
+        }
+		
+        [Test]
+        public virtual void  TestSpanWithMultipleNotMany()
+        {
+            SpanTermQuery term1 = new SpanTermQuery(new Term("field", "eight"));
+            SpanTermQuery term2 = new SpanTermQuery(new Term("field", "one"));
+            SpanNearQuery near = new SpanNearQuery(new SpanQuery[]{term1, term2}, 4, true);
+            SpanTermQuery term3 = new SpanTermQuery(new Term("field", "forty"));
+            SpanTermQuery term4 = new SpanTermQuery(new Term("field", "sixty"));
+            SpanTermQuery term5 = new SpanTermQuery(new Term("field", "eighty"));
+			
+            SpanOrQuery or = new SpanOrQuery(new SpanQuery[]{term3, term4, term5});
+			
+            SpanNotQuery query = new SpanNotQuery(near, or);
+			
+            CheckHits(query, new int[]{801, 821, 831, 851, 871, 891});
+			
+            Assert.IsTrue(searcher.Explain(query, 801).GetValue() > 0.0f);
+            Assert.IsTrue(searcher.Explain(query, 891).GetValue() > 0.0f);
+        }
+		
+        [Test]
+        public virtual void  TestNpeInSpanNearWithSpanNot()
+        {
+            SpanTermQuery term1 = new SpanTermQuery(new Term("field", "eight"));
+            SpanTermQuery term2 = new SpanTermQuery(new Term("field", "one"));
+            SpanNearQuery near = new SpanNearQuery(new SpanQuery[]{term1, term2}, 4, true);
+            SpanTermQuery hun = new SpanTermQuery(new Term("field", "hundred"));
+            SpanTermQuery term3 = new SpanTermQuery(new Term("field", "forty"));
+            SpanNearQuery exclude = new SpanNearQuery(new SpanQuery[]{hun, term3}, 1, true);
+			
+            SpanNotQuery query = new SpanNotQuery(near, exclude);
+			
+            CheckHits(query, new int[]{801, 821, 831, 851, 861, 871, 881, 891});
+			
+            Assert.IsTrue(searcher.Explain(query, 801).GetValue() > 0.0f);
+            Assert.IsTrue(searcher.Explain(query, 891).GetValue() > 0.0f);
+        }
+		
+		
+        [Test]
+        public virtual void  TestNpeInSpanNearInSpanFirstInSpanNot()
+        {
+            int n = 5;
+            SpanTermQuery hun = new SpanTermQuery(new Term("field", "hundred"));
+            SpanTermQuery term40 = new SpanTermQuery(new Term("field", "forty"));
+            SpanTermQuery term40c = (SpanTermQuery) term40.Clone();
+			
+            SpanFirstQuery include = new SpanFirstQuery(term40, n);
+            SpanNearQuery near = new SpanNearQuery(new SpanQuery[]{hun, term40c}, n - 1, true);
+            SpanFirstQuery exclude = new SpanFirstQuery(near, n - 1);
+            SpanNotQuery q = new SpanNotQuery(include, exclude);
+			
+            CheckHits(q, new int[]{40, 41, 42, 43, 44, 45, 46, 47, 48, 49});
+        }
+		
+        [Test]
         public virtual void  TestSpanFirst()
 		{
 			SpanTermQuery term1 = new SpanTermQuery(new Term("field", "five"));
@@ -252,7 +329,8 @@
 		
 		private void  CheckHits(Query query, int[] results)
 		{
-			Lucene.Net.Search.CheckHits.CheckHits_Renamed_Method(query, "field", searcher, results);
-		}
+            Lucene.Net.Search.CheckHits.CheckHits_Renamed_Method(query, "field", searcher, results);
+            QueryUtils.Check(query);
+        }
 	}
 }

Modified: incubator/lucene.net/trunk/C#/src/Test/Search/Spans/TestSpansAdvanced.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Search/Spans/TestSpansAdvanced.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Search/Spans/TestSpansAdvanced.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Search/Spans/TestSpansAdvanced.cs Thu Aug 17 06:49:26 2006
@@ -46,7 +46,9 @@
 		// location to the index
 		protected internal Directory mDirectory; 
 		
-		// field names in the index
+        protected internal IndexSearcher searcher;
+		
+        // field names in the index
 		private const System.String FIELD_ID = "ID";
 		protected internal const System.String FIELD_TEXT = "TEXT";
 		
@@ -63,13 +65,14 @@
 			AddDocument(writer, "3", "I think it should work.");
 			AddDocument(writer, "4", "I think it should work.");
 			writer.Close();
-		}
+            searcher = new IndexSearcher(mDirectory);
+        }
 		
 		[TearDown]
         public virtual void  TearDown()
 		{
-			
-			mDirectory.Close();
+            searcher.Close();
+            mDirectory.Close();
 			mDirectory = null;
 		}
 		
@@ -100,41 +103,25 @@
         public virtual void  TestBooleanQueryWithSpanQueries()
 		{
 			
-			DoTestBooleanQueryWithSpanQueries(0.3884282f);
+			DoTestBooleanQueryWithSpanQueries(searcher, 0.3884282f);
 		}
 		
 		/// <summary> Tests two span queries.
 		/// 
 		/// </summary>
 		/// <throws>  IOException </throws>
-		protected internal virtual void  DoTestBooleanQueryWithSpanQueries(float expectedScore)
+		protected internal virtual void  DoTestBooleanQueryWithSpanQueries(IndexSearcher s, float expectedScore)
 		{
 			
 			Query spanQuery = new SpanTermQuery(new Term(FIELD_TEXT, "work"));
 			BooleanQuery query = new BooleanQuery();
 			query.Add(spanQuery, BooleanClause.Occur.MUST);
 			query.Add(spanQuery, BooleanClause.Occur.MUST);
-			Hits hits = ExecuteQuery(query);
-			System.String[] expectedIds = new System.String[]{"1", "2", "3", "4"};
+            System.String[] expectedIds = new System.String[]{"1", "2", "3", "4"};
 			float[] expectedScores = new float[]{expectedScore, expectedScore, expectedScore, expectedScore};
-			AssertHits(hits, "two span queries", expectedIds, expectedScores);
+            AssertHits(s, query, "two span queries", expectedIds, expectedScores);
 		}
 		
-		/// <summary> Executes the query and throws an assertion if the results don't match the
-		/// expectedHits.
-		/// 
-		/// </summary>
-		/// <param name="query">the query to execute
-		/// </param>
-		/// <throws>  IOException </throws>
-		protected internal virtual Hits ExecuteQuery(Query query)
-		{
-			
-			IndexSearcher searcher = new IndexSearcher(mDirectory);
-			Hits hits = searcher.Search(query);
-			searcher.Close();
-			return hits;
-		}
 		
 		/// <summary> Checks to see if the hits are what we expected.
 		/// 
@@ -149,22 +136,43 @@
 		/// 
 		/// </param>
 		/// <throws>  IOException </throws>
-		protected internal virtual void  AssertHits(Hits hits, System.String description, System.String[] expectedIds, float[] expectedScores)
+		protected internal virtual void  AssertHits(Searcher s, Query query, System.String description, System.String[] expectedIds, float[] expectedScores)
 		{
+            float tolerance = 1e-5f;
 			
-			// display the hits
-			/*System.out.println(hits.length() + " hits for search: \"" + description + '\"');
-			for (int i = 0; i < hits.length(); i++) {
-			System.out.println("  " + FIELD_ID + ':' + hits.doc(i).get(FIELD_ID) + " (score:" + hits.score(i) + ')');
-			}*/
-			
-			// did we get the hits we expected
-			Assert.AreEqual(expectedIds.Length, hits.Length());
-			for (int i = 0; i < hits.Length(); i++)
-			{
-				Assert.IsTrue(expectedIds[i].Equals(hits.Doc(i).Get(FIELD_ID)));
-				Assert.AreEqual(expectedScores[i], hits.Score(i), 0);
-			}
-		}
+            // Hits hits = searcher.search(query);
+            // hits normalizes and throws things off if one score is greater than 1.0
+            TopDocs topdocs = s.Search(query, null, 10000);
+			
+            /// <summary>**
+            /// // display the hits
+            /// System.out.println(hits.length() + " hits for search: \"" + description + '\"');
+            /// for (int i = 0; i < hits.length(); i++) {
+            /// System.out.println("  " + FIELD_ID + ':' + hits.doc(i).get(FIELD_ID) + " (score:" + hits.score(i) + ')');
+            /// }
+            /// ***
+            /// </summary>
+			
+            // did we get the hits we expected
+            Assert.AreEqual(expectedIds.Length, topdocs.totalHits);
+            for (int i = 0; i < topdocs.totalHits; i++)
+            {
+                //System.out.println(i + " exp: " + expectedIds[i]);
+                //System.out.println(i + " field: " + hits.doc(i).get(FIELD_ID));
+				
+                int id = topdocs.scoreDocs[i].doc;
+                float score = topdocs.scoreDocs[i].score;
+                Lucene.Net.Documents.Document doc = s.Doc(id);
+                Assert.AreEqual(expectedIds[i], doc.Get(FIELD_ID));
+                bool scoreEq = System.Math.Abs(expectedScores[i] - score) < tolerance;
+                if (!scoreEq)
+                {
+                    System.Console.Out.WriteLine(i + " warning, expected score: " + expectedScores[i] + ", actual " + score);
+                    System.Console.Out.WriteLine(s.Explain(query, id));
+                }
+                Assert.AreEqual(expectedScores[i], score, tolerance);
+                Assert.AreEqual(s.Explain(query, id).GetValue(), score, tolerance);
+            }
+        }
 	}
 }

Modified: incubator/lucene.net/trunk/C#/src/Test/Search/Spans/TestSpansAdvanced2.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Search/Spans/TestSpansAdvanced2.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Search/Spans/TestSpansAdvanced2.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Search/Spans/TestSpansAdvanced2.cs Thu Aug 17 06:49:26 2006
@@ -37,7 +37,7 @@
 	/// </author>
 	public class TestSpansAdvanced2:TestSpansAdvanced
 	{
-		
+		internal IndexSearcher searcher2;
 		/// <summary> Initializes the tests by adding documents to the index.</summary>
 		[SetUp]
         public virtual void  SetUp()
@@ -51,7 +51,10 @@
 			AddDocument(writer, "C", "It shouldn't.");
 			AddDocument(writer, "D", "Should we, should we, should we.");
 			writer.Close();
-		}
+			
+            // re-open the searcher since we added more docs
+            searcher2 = new IndexSearcher(mDirectory);
+        }
 		
 		/// <summary> Verifies that the index has the correct number of documents.
 		/// 
@@ -74,10 +77,9 @@
 		{
 			
 			Query spanQuery = new SpanTermQuery(new Term(FIELD_TEXT, "should"));
-			Hits hits = ExecuteQuery(spanQuery);
 			System.String[] expectedIds = new System.String[]{"B", "D", "1", "2", "3", "4", "A"};
 			float[] expectedScores = new float[]{0.625f, 0.45927936f, 0.35355338f, 0.35355338f, 0.35355338f, 0.35355338f, 0.26516503f};
-			AssertHits(hits, "single span query", expectedIds, expectedScores);
+			AssertHits(searcher2, spanQuery, "single span query", expectedIds, expectedScores);
 		}
 		
 		/// <summary> Tests a single span query that matches multiple documents.
@@ -93,10 +95,11 @@
 			BooleanQuery query = new BooleanQuery();
 			query.Add(spanQuery1, BooleanClause.Occur.MUST);
 			query.Add(spanQuery2, BooleanClause.Occur.MUST);
-			Hits hits = ExecuteQuery(query);
-			System.String[] expectedIds = new System.String[]{"A", "D"};
-			float[] expectedScores = new float[]{0.93163157f, 0.20698164f};
-			AssertHits(hits, "multiple different span queries", expectedIds, expectedScores);
+			System.String[] expectedIds = new System.String[]{"D", "A"};
+            // these values were pre LUCENE-413
+            // float[] expectedScores = new float[]{0.93163157f, 0.20698164f};
+            float[] expectedScores = new float[]{1.0191123f, 0.93163157f};
+            AssertHits(searcher2, query, "multiple different span queries", expectedIds, expectedScores);
 		}
 		
 		/// <summary> Tests two span queries.
@@ -107,7 +110,7 @@
         public override void  TestBooleanQueryWithSpanQueries()
 		{
 			
-			DoTestBooleanQueryWithSpanQueries(0.73500174f);
+			DoTestBooleanQueryWithSpanQueries(searcher2, 0.73500174f);
 		}
 	}
 }

Modified: incubator/lucene.net/trunk/C#/src/Test/Search/TestBooleanMinShouldMatch.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Search/TestBooleanMinShouldMatch.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Search/TestBooleanMinShouldMatch.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Search/TestBooleanMinShouldMatch.cs Thu Aug 17 06:49:26 2006
@@ -89,12 +89,12 @@
 			for (int i = 0; i < data.Length; i++)
 			{
 				Lucene.Net.Documents.Document doc = new Lucene.Net.Documents.Document();
-				doc.Add(Field.Keyword("id", System.Convert.ToString(i)));
-				doc.Add(Field.Keyword("all", "all"));
-				if (null != data[i])
+                doc.Add(new Field("id", System.Convert.ToString(i), Field.Store.YES, Field.Index.UN_TOKENIZED)); //Field.Keyword("id",String.valueOf(i)));
+                doc.Add(new Field("all", "all", Field.Store.YES, Field.Index.UN_TOKENIZED)); //Field.Keyword("all","all"));
+                if (null != data[i])
 				{
-					doc.Add(Field.Text("data", data[i]));
-				}
+                    doc.Add(new Field("data", data[i], Field.Store.YES, Field.Index.TOKENIZED)); //Field.Text("data",data[i]));
+                }
 				writer.AddDocument(doc);
 			}
 			
@@ -113,7 +113,7 @@
 			if (expected != h.Length())
 			{
 				PrintHits("TestBooleanMinShouldMatch", h);  // PrintHits(NUnit.Framework.TestCase.GetName(), h);    // {{Aroush-1.9}} 'GetName()' gives us the name of the test in JUnit, how is it done in NUnit?
-			}
+            }
 			Assert.AreEqual(expected, h.Length(), "result count");
 		}
 		
@@ -124,7 +124,7 @@
 			BooleanQuery q = new BooleanQuery();
 			for (int i = 1; i <= 4; i++)
 			{
-				q.Add(new TermQuery(new Term("data", "" + i)), false, false);
+				q.Add(new TermQuery(new Term("data", "" + i)), BooleanClause.Occur.SHOULD); //false, false);
 			}
 			q.SetMinimumNumberShouldMatch(2); // match at least two of 4
 			VerifyNrHits(q, 2);
@@ -136,10 +136,10 @@
 			
 			/* one required, some optional */
 			BooleanQuery q = new BooleanQuery();
-			q.Add(new TermQuery(new Term("all", "all")), true, false);
-			q.Add(new TermQuery(new Term("data", "5")), false, false);
-			q.Add(new TermQuery(new Term("data", "4")), false, false);
-			q.Add(new TermQuery(new Term("data", "3")), false, false);
+            q.Add(new TermQuery(new Term("all", "all")), BooleanClause.Occur.MUST); //true,  false);
+            q.Add(new TermQuery(new Term("data", "5")), BooleanClause.Occur.SHOULD); //false, false);
+            q.Add(new TermQuery(new Term("data", "4")), BooleanClause.Occur.SHOULD); //false, false);
+            q.Add(new TermQuery(new Term("data", "3")), BooleanClause.Occur.SHOULD); //false, false);
 			
 			q.SetMinimumNumberShouldMatch(2); // 2 of 3 optional 
 			
@@ -152,11 +152,11 @@
 			
 			/* two required, some optional */
 			BooleanQuery q = new BooleanQuery();
-			q.Add(new TermQuery(new Term("all", "all")), true, false);
-			q.Add(new TermQuery(new Term("data", "6")), true, false);
-			q.Add(new TermQuery(new Term("data", "5")), false, false);
-			q.Add(new TermQuery(new Term("data", "4")), false, false);
-			q.Add(new TermQuery(new Term("data", "3")), false, false);
+            q.Add(new TermQuery(new Term("all", "all")), BooleanClause.Occur.MUST); //true,  false);
+            q.Add(new TermQuery(new Term("data", "6")), BooleanClause.Occur.MUST); //true,  false);
+            q.Add(new TermQuery(new Term("data", "5")), BooleanClause.Occur.SHOULD); //false, false);
+            q.Add(new TermQuery(new Term("data", "4")), BooleanClause.Occur.SHOULD); //false, false);
+            q.Add(new TermQuery(new Term("data", "3")), BooleanClause.Occur.SHOULD); //false, false);
 			
 			q.SetMinimumNumberShouldMatch(2); // 2 of 3 optional 
 			
@@ -169,10 +169,10 @@
 			
 			/* one prohibited, some optional */
 			BooleanQuery q = new BooleanQuery();
-			q.Add(new TermQuery(new Term("data", "1")), false, false);
-			q.Add(new TermQuery(new Term("data", "2")), false, false);
-			q.Add(new TermQuery(new Term("data", "3")), false, true);
-			q.Add(new TermQuery(new Term("data", "4")), false, false);
+            q.Add(new TermQuery(new Term("data", "1")), BooleanClause.Occur.SHOULD); //false, false);
+            q.Add(new TermQuery(new Term("data", "2")), BooleanClause.Occur.SHOULD); //false, false);
+            q.Add(new TermQuery(new Term("data", "3")), BooleanClause.Occur.MUST_NOT); //false, true );
+            q.Add(new TermQuery(new Term("data", "4")), BooleanClause.Occur.SHOULD); //false, false);
 			
 			q.SetMinimumNumberShouldMatch(2); // 2 of 3 optional 
 			
@@ -185,11 +185,11 @@
 			
 			/* two prohibited, some optional */
 			BooleanQuery q = new BooleanQuery();
-			q.Add(new TermQuery(new Term("data", "1")), false, false);
-			q.Add(new TermQuery(new Term("data", "2")), false, false);
-			q.Add(new TermQuery(new Term("data", "3")), false, true);
-			q.Add(new TermQuery(new Term("data", "4")), false, false);
-			q.Add(new TermQuery(new Term("data", "C")), false, true);
+            q.Add(new TermQuery(new Term("data", "1")), BooleanClause.Occur.SHOULD); //false, false);
+            q.Add(new TermQuery(new Term("data", "2")), BooleanClause.Occur.SHOULD); //false, false);
+            q.Add(new TermQuery(new Term("data", "3")), BooleanClause.Occur.MUST_NOT); //false, true );
+            q.Add(new TermQuery(new Term("data", "4")), BooleanClause.Occur.SHOULD); //false, false);
+            q.Add(new TermQuery(new Term("data", "C")), BooleanClause.Occur.MUST_NOT); //false, true );
 			
 			q.SetMinimumNumberShouldMatch(2); // 2 of 3 optional 
 			
@@ -202,12 +202,12 @@
 			
 			/* one required, one prohibited, some optional */
 			BooleanQuery q = new BooleanQuery();
-			q.Add(new TermQuery(new Term("data", "6")), true, false);
-			q.Add(new TermQuery(new Term("data", "5")), false, false);
-			q.Add(new TermQuery(new Term("data", "4")), false, false);
-			q.Add(new TermQuery(new Term("data", "3")), false, true);
-			q.Add(new TermQuery(new Term("data", "2")), false, false);
-			q.Add(new TermQuery(new Term("data", "1")), false, false);
+            q.Add(new TermQuery(new Term("data", "6")), BooleanClause.Occur.MUST); // true,  false);
+            q.Add(new TermQuery(new Term("data", "5")), BooleanClause.Occur.SHOULD); //false, false);
+            q.Add(new TermQuery(new Term("data", "4")), BooleanClause.Occur.SHOULD); //false, false);
+            q.Add(new TermQuery(new Term("data", "3")), BooleanClause.Occur.MUST_NOT); //false, true );
+            q.Add(new TermQuery(new Term("data", "2")), BooleanClause.Occur.SHOULD); //false, false);
+            q.Add(new TermQuery(new Term("data", "1")), BooleanClause.Occur.SHOULD); //false, false);
 			
 			q.SetMinimumNumberShouldMatch(3); // 3 of 4 optional 
 			
@@ -220,13 +220,13 @@
 			
 			/* two required, one prohibited, some optional */
 			BooleanQuery q = new BooleanQuery();
-			q.Add(new TermQuery(new Term("all", "all")), true, false);
-			q.Add(new TermQuery(new Term("data", "6")), true, false);
-			q.Add(new TermQuery(new Term("data", "5")), false, false);
-			q.Add(new TermQuery(new Term("data", "4")), false, false);
-			q.Add(new TermQuery(new Term("data", "3")), false, true);
-			q.Add(new TermQuery(new Term("data", "2")), false, false);
-			q.Add(new TermQuery(new Term("data", "1")), false, false);
+            q.Add(new TermQuery(new Term("all", "all")), BooleanClause.Occur.MUST); //true,  false);
+            q.Add(new TermQuery(new Term("data", "6")), BooleanClause.Occur.MUST); //true,  false);
+            q.Add(new TermQuery(new Term("data", "5")), BooleanClause.Occur.SHOULD); //false, false);
+            q.Add(new TermQuery(new Term("data", "4")), BooleanClause.Occur.SHOULD); //false, false);
+            q.Add(new TermQuery(new Term("data", "3")), BooleanClause.Occur.MUST_NOT); //false, true );
+            q.Add(new TermQuery(new Term("data", "2")), BooleanClause.Occur.SHOULD); //false, false);
+            q.Add(new TermQuery(new Term("data", "1")), BooleanClause.Occur.SHOULD); //false, false);
 			
 			q.SetMinimumNumberShouldMatch(3); // 3 of 4 optional 
 			
@@ -239,13 +239,13 @@
 			
 			/* one required, two prohibited, some optional */
 			BooleanQuery q = new BooleanQuery();
-			q.Add(new TermQuery(new Term("data", "6")), true, false);
-			q.Add(new TermQuery(new Term("data", "5")), false, false);
-			q.Add(new TermQuery(new Term("data", "4")), false, false);
-			q.Add(new TermQuery(new Term("data", "3")), false, true);
-			q.Add(new TermQuery(new Term("data", "2")), false, false);
-			q.Add(new TermQuery(new Term("data", "1")), false, false);
-			q.Add(new TermQuery(new Term("data", "C")), false, true);
+            q.Add(new TermQuery(new Term("data", "6")), BooleanClause.Occur.MUST); //true,  false);
+            q.Add(new TermQuery(new Term("data", "5")), BooleanClause.Occur.SHOULD); //false, false);
+            q.Add(new TermQuery(new Term("data", "4")), BooleanClause.Occur.SHOULD); //false, false);
+            q.Add(new TermQuery(new Term("data", "3")), BooleanClause.Occur.MUST_NOT); //false, true );
+            q.Add(new TermQuery(new Term("data", "2")), BooleanClause.Occur.SHOULD); //false, false);
+            q.Add(new TermQuery(new Term("data", "1")), BooleanClause.Occur.SHOULD); //false, false);
+            q.Add(new TermQuery(new Term("data", "C")), BooleanClause.Occur.MUST_NOT); //false, true );
 			
 			q.SetMinimumNumberShouldMatch(3); // 3 of 4 optional 
 			
@@ -258,14 +258,14 @@
 			
 			/* two required, two prohibited, some optional */
 			BooleanQuery q = new BooleanQuery();
-			q.Add(new TermQuery(new Term("all", "all")), true, false);
-			q.Add(new TermQuery(new Term("data", "6")), true, false);
-			q.Add(new TermQuery(new Term("data", "5")), false, false);
-			q.Add(new TermQuery(new Term("data", "4")), false, false);
-			q.Add(new TermQuery(new Term("data", "3")), false, true);
-			q.Add(new TermQuery(new Term("data", "2")), false, false);
-			q.Add(new TermQuery(new Term("data", "1")), false, false);
-			q.Add(new TermQuery(new Term("data", "C")), false, true);
+            q.Add(new TermQuery(new Term("all", "all")), BooleanClause.Occur.MUST); //true,  false);
+            q.Add(new TermQuery(new Term("data", "6")), BooleanClause.Occur.MUST); //true,  false);
+            q.Add(new TermQuery(new Term("data", "5")), BooleanClause.Occur.SHOULD); //false, false);
+            q.Add(new TermQuery(new Term("data", "4")), BooleanClause.Occur.SHOULD); //false, false);
+            q.Add(new TermQuery(new Term("data", "3")), BooleanClause.Occur.MUST_NOT); //false, true );
+            q.Add(new TermQuery(new Term("data", "2")), BooleanClause.Occur.SHOULD); //false, false);
+            q.Add(new TermQuery(new Term("data", "1")), BooleanClause.Occur.SHOULD); //false, false);
+            q.Add(new TermQuery(new Term("data", "C")), BooleanClause.Occur.MUST_NOT); //false, true );
 			
 			q.SetMinimumNumberShouldMatch(3); // 3 of 4 optional 
 			
@@ -278,14 +278,14 @@
 			
 			/* two required, two prohibited, some optional */
 			BooleanQuery q = new BooleanQuery();
-			q.Add(new TermQuery(new Term("all", "all")), true, false);
-			q.Add(new TermQuery(new Term("data", "6")), true, false);
-			q.Add(new TermQuery(new Term("data", "5")), false, false);
-			q.Add(new TermQuery(new Term("data", "4")), false, false);
-			q.Add(new TermQuery(new Term("data", "3")), false, true);
-			q.Add(new TermQuery(new Term("data", "2")), false, false);
-			q.Add(new TermQuery(new Term("data", "1")), false, false);
-			q.Add(new TermQuery(new Term("data", "C")), false, true);
+            q.Add(new TermQuery(new Term("all", "all")), BooleanClause.Occur.MUST); //true,  false);
+            q.Add(new TermQuery(new Term("data", "6")), BooleanClause.Occur.MUST); //true,  false);
+            q.Add(new TermQuery(new Term("data", "5")), BooleanClause.Occur.SHOULD); //false, false);
+            q.Add(new TermQuery(new Term("data", "4")), BooleanClause.Occur.SHOULD); //false, false);
+            q.Add(new TermQuery(new Term("data", "3")), BooleanClause.Occur.MUST_NOT); //false, true );
+            q.Add(new TermQuery(new Term("data", "2")), BooleanClause.Occur.SHOULD); //false, false);
+            q.Add(new TermQuery(new Term("data", "1")), BooleanClause.Occur.SHOULD); //false, false);
+            q.Add(new TermQuery(new Term("data", "C")), BooleanClause.Occur.MUST_NOT); //false, true );
 			
 			q.SetMinimumNumberShouldMatch(90); // 90 of 4 optional ?!?!?!
 			
@@ -298,10 +298,10 @@
 			
 			/* two required, two optional */
 			BooleanQuery q = new BooleanQuery();
-			q.Add(new TermQuery(new Term("all", "all")), false, false);
-			q.Add(new TermQuery(new Term("data", "6")), true, false);
-			q.Add(new TermQuery(new Term("data", "3")), true, false);
-			q.Add(new TermQuery(new Term("data", "2")), false, false);
+            q.Add(new TermQuery(new Term("all", "all")), BooleanClause.Occur.SHOULD); //false, false);
+            q.Add(new TermQuery(new Term("data", "6")), BooleanClause.Occur.MUST); //true,  false);
+            q.Add(new TermQuery(new Term("data", "3")), BooleanClause.Occur.MUST); //true,  false);
+            q.Add(new TermQuery(new Term("data", "2")), BooleanClause.Occur.SHOULD); //false, false);
 			
 			q.SetMinimumNumberShouldMatch(2); // 2 of 2 optional 
 			
@@ -314,9 +314,9 @@
 			
 			/* two required, one optional */
 			BooleanQuery q = new BooleanQuery();
-			q.Add(new TermQuery(new Term("all", "all")), true, false);
-			q.Add(new TermQuery(new Term("data", "3")), false, false);
-			q.Add(new TermQuery(new Term("data", "2")), true, false);
+            q.Add(new TermQuery(new Term("all", "all")), BooleanClause.Occur.MUST); //true,  false);
+            q.Add(new TermQuery(new Term("data", "3")), BooleanClause.Occur.SHOULD); //false, false);
+            q.Add(new TermQuery(new Term("data", "2")), BooleanClause.Occur.MUST); //true,  false);
 			
 			q.SetMinimumNumberShouldMatch(1); // 1 of 1 optional 
 			
@@ -329,8 +329,8 @@
 			
 			/* two required, no optional */
 			BooleanQuery q = new BooleanQuery();
-			q.Add(new TermQuery(new Term("all", "all")), true, false);
-			q.Add(new TermQuery(new Term("data", "2")), true, false);
+            q.Add(new TermQuery(new Term("all", "all")), BooleanClause.Occur.MUST); //true,  false);
+            q.Add(new TermQuery(new Term("data", "2")), BooleanClause.Occur.MUST); //true,  false);
 			
 			q.SetMinimumNumberShouldMatch(1); // 1 of 0 optional 
 			
@@ -350,7 +350,7 @@
 			TestBoolean2.Callback minNrCB = new AnonymousClassCallback(rnd, this);
 			
 			
-			int tot = 0;
+
 			// increase number of iterations for more complete testing      
 			for (int i = 0; i < 1000; i++)
 			{
@@ -367,7 +367,6 @@
 				// will not normalize scores.
 				TopDocs top1 = s.Search(q1, null, 100);
 				TopDocs top2 = s.Search(q2, null, 100);
-				tot += top2.totalHits;
 				
 				// The constrained query
 				// should be a superset to the unconstrained query.

Modified: incubator/lucene.net/trunk/C#/src/Test/Search/TestBooleanOr.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Search/TestBooleanOr.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Search/TestBooleanOr.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Search/TestBooleanOr.cs Thu Aug 17 06:49:26 2006
@@ -138,6 +138,8 @@
 		[SetUp]
         public virtual void  SetUp()
 		{
+            //base.SetUp();
+
 			//
 			RAMDirectory rd = new RAMDirectory();
 			

Modified: incubator/lucene.net/trunk/C#/src/Test/Search/TestConstantScoreRangeQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Search/TestConstantScoreRangeQuery.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Search/TestConstantScoreRangeQuery.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Search/TestConstantScoreRangeQuery.cs Thu Aug 17 06:49:26 2006
@@ -85,12 +85,12 @@
 			for (int i = 0; i < data.Length; i++)
 			{
 				Lucene.Net.Documents.Document doc = new Lucene.Net.Documents.Document();
-				doc.Add(Field.Keyword("id", System.Convert.ToString(i)));
-				doc.Add(Field.Keyword("all", "all"));
+                doc.Add(new Field("id", System.Convert.ToString(i), Field.Store.YES, Field.Index.UN_TOKENIZED)); //Field.Keyword("id",String.valueOf(i)));
+                doc.Add(new Field("all", "all", Field.Store.YES, Field.Index.UN_TOKENIZED)); //Field.Keyword("all","all"));
 				if (null != data[i])
 				{
-					doc.Add(Field.Text("data", data[i]));
-				}
+                    doc.Add(new Field("data", data[i], Field.Store.YES, Field.Index.TOKENIZED)); //Field.Text("data",data[i]));
+                }
 				writer.AddDocument(doc);
 			}
 			
@@ -200,8 +200,8 @@
 			// ConstantScoreRangeQuery and make sure hte order is the same
 			
 			BooleanQuery q = new BooleanQuery();
-			q.Add(rq, T, F);
-			q.Add(Csrq("data", "1", "6", T, T), T, F);
+            q.Add(rq, BooleanClause.Occur.MUST); //T, F);
+            q.Add(Csrq("data", "1", "6", T, T), BooleanClause.Occur.MUST); //T, F);
 			
 			Hits actual = search.Search(q);
 			
@@ -212,7 +212,10 @@
 			}
 		}
 		
-		[Test]
+		
+		
+		
+        [Test]
         public virtual void  TestRangeQueryId()
 		{
 			// NOTE: uses index build in *super* SetUp

Modified: incubator/lucene.net/trunk/C#/src/Test/Search/TestCustomSearcherSort.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Search/TestCustomSearcherSort.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Search/TestCustomSearcherSort.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Search/TestCustomSearcherSort.cs Thu Aug 17 06:49:26 2006
@@ -39,14 +39,47 @@
 	[TestFixture]
     public class TestCustomSearcherSort
 	{
+        private Directory Index
+        {
+            // create an index for testing
+			
+            get
+            {
+                RAMDirectory indexStore = new RAMDirectory();
+                IndexWriter writer = new IndexWriter(indexStore, new StandardAnalyzer(), true);
+                RandomGen random = new RandomGen(this);
+                for (int i = 0; i < INDEX_SIZE; ++i)
+                {
+                    // don't decrease; if to low the problem doesn't show up
+                    Lucene.Net.Documents.Document doc = new Lucene.Net.Documents.Document();
+                    if ((i % 5) != 0)
+                    {
+                        // some documents must not have an entry in the first sort field
+                        doc.Add(new Field("publicationDate_", random.GetLuceneDate(), Field.Store.YES, Field.Index.UN_TOKENIZED));
+                    }
+                    if ((i % 7) == 0)
+                    {
+                        // some documents to match the query (see below) 
+                        doc.Add(new Field("content", "test", Field.Store.YES, Field.Index.TOKENIZED));
+                    }
+                    // every document has a defined 'mandant' field
+                    doc.Add(new Field("mandant", System.Convert.ToString(i % 3), Field.Store.YES, Field.Index.UN_TOKENIZED));
+                    writer.AddDocument(doc);
+                }
+                writer.Optimize();
+                writer.Close();
+                return indexStore;
+            }
+			
+        }
 		
-		private Directory index = null;
+        private Directory index = null;
 		private Query query = null;
 		// reduced from 20000 to 2000 to speed up test...
 		private const int INDEX_SIZE = 2000;
 		
 		
-		[STAThread]
+        [STAThread]
 		public static void  Main(System.String[] argv)
 		{
 			// TestRunner.run(Suite()); // {{Aroush}} how is this done in NUnit?
@@ -57,77 +90,47 @@
 			return null; // return new NUnit.Core.TestSuite(typeof(TestCustomSearcherSort)); {{Aroush}} how is this done in NUnit?
 		}
 		
-		
-		// create an index for testing
-		private Directory GetIndex()
-		{
-			RAMDirectory indexStore = new RAMDirectory();
-			IndexWriter writer = new IndexWriter(indexStore, new StandardAnalyzer(), true);
-			RandomGen random = new RandomGen(this);
-			for (int i = 0; i < INDEX_SIZE; ++i)
-			{
-				// don't decrease; if to low the problem doesn't show up
-				Lucene.Net.Documents.Document doc = new Lucene.Net.Documents.Document();
-				if ((i % 5) != 0)
-				{
-					// some documents must not have an entry in the first sort field
-					doc.Add(new Field("publicationDate_", random.GetLuceneDate(), Field.Store.YES, Field.Index.UN_TOKENIZED));
-				}
-				if ((i % 7) == 0)
-				{
-					// some documents to match the query (see below) 
-					doc.Add(new Field("content", "test", Field.Store.YES, Field.Index.TOKENIZED));
-				}
-				// every document has a defined 'mandant' field
-				doc.Add(new Field("mandant", System.Convert.ToString(i % 3), Field.Store.YES, Field.Index.UN_TOKENIZED));
-				writer.AddDocument(doc);
-			}
-			writer.Optimize();
-			writer.Close();
-			return indexStore;
-		}
-		
-		/// <summary> Create index and query for test cases. </summary>
-		[SetUp]
+        /// <summary> Create index and query for test cases. </summary>
+        [SetUp]
         public virtual void  SetUp()
-		{
-			index = GetIndex();
-			query = new TermQuery(new Term("content", "test"));
-		}
+        {
+            index = Index;
+            query = new TermQuery(new Term("content", "test"));
+        }
 		
-		/// <summary> Run the test using two CustomSearcher instances. </summary>
+        /// <summary> Run the test using two CustomSearcher instances. </summary>
         [Test]
         public virtual void  TestFieldSortCustomSearcher()
-		{
-			// log("Run testFieldSortCustomSearcher");
-			// define the sort criteria
-			Sort custSort = new Sort(new SortField[]{new SortField("publicationDate_"), SortField.FIELD_SCORE});
-			Searcher searcher = new CustomSearcher(this, index, 2);
-			// search and check hits
-			MatchHits(searcher, custSort);
-		}
-		/// <summary> Run the test using one CustomSearcher wrapped by a MultiSearcher. </summary>
-		[Test]
+        {
+            // log("Run testFieldSortCustomSearcher");
+            // define the sort criteria
+            Sort custSort = new Sort(new SortField[]{new SortField("publicationDate_"), SortField.FIELD_SCORE});
+            Searcher searcher = new CustomSearcher(this, index, 2);
+            // search and check hits
+            MatchHits(searcher, custSort);
+        }
+        /// <summary> Run the test using one CustomSearcher wrapped by a MultiSearcher. </summary>
+        [Test]
         public virtual void  TestFieldSortSingleSearcher()
-		{
-			// log("Run testFieldSortSingleSearcher");
-			// define the sort criteria
-			Sort custSort = new Sort(new SortField[]{new SortField("publicationDate_"), SortField.FIELD_SCORE});
-			Searcher searcher = new MultiSearcher(new Lucene.Net.Search.Searchable[]{new CustomSearcher(this, index, 2)});
-			// search and check hits
-			MatchHits(searcher, custSort);
-		}
-		/// <summary> Run the test using two CustomSearcher instances. </summary>
-		[Test]
+        {
+            // log("Run testFieldSortSingleSearcher");
+            // define the sort criteria
+            Sort custSort = new Sort(new SortField[]{new SortField("publicationDate_"), SortField.FIELD_SCORE});
+            Searcher searcher = new MultiSearcher(new Lucene.Net.Search.Searchable[]{new CustomSearcher(this, index, 2)});
+            // search and check hits
+            MatchHits(searcher, custSort);
+        }
+        /// <summary> Run the test using two CustomSearcher instances. </summary>
+        [Test]
         public virtual void  TestFieldSortMultiCustomSearcher()
-		{
-			// log("Run testFieldSortMultiCustomSearcher");
-			// define the sort criteria
-			Sort custSort = new Sort(new SortField[]{new SortField("publicationDate_"), SortField.FIELD_SCORE});
-			Searcher searcher = new MultiSearcher(new Lucene.Net.Search.Searchable[]{new CustomSearcher(this, index, 0), new CustomSearcher(this, index, 2)});
-			// search and check hits
-			MatchHits(searcher, custSort);
-		}
+        {
+            // log("Run testFieldSortMultiCustomSearcher");
+            // define the sort criteria
+            Sort custSort = new Sort(new SortField[]{new SortField("publicationDate_"), SortField.FIELD_SCORE});
+            Searcher searcher = new MultiSearcher(new Lucene.Net.Search.Searchable[]{new CustomSearcher(this, index, 0), new CustomSearcher(this, index, 2)});
+            // search and check hits
+            MatchHits(searcher, custSort);
+        }
 		
 		
 		// make sure the documents returned by the search match the expected list
@@ -299,7 +302,9 @@
 			private TestCustomSearcherSort enclosingInstance;
 			public TestCustomSearcherSort Enclosing_Instance
 			{
-				get
+                // Just to generate some different Lucene Date strings
+				
+                get
 				{
 					return enclosingInstance;
 				}

Modified: incubator/lucene.net/trunk/C#/src/Test/Search/TestDateFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Search/TestDateFilter.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Search/TestDateFilter.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Search/TestDateFilter.cs Thu Aug 17 06:49:26 2006
@@ -50,8 +50,8 @@
 			
 			Lucene.Net.Documents.Document doc = new Lucene.Net.Documents.Document();
 			// add time that is in the past
-			doc.Add(new Field("datefield", DateField.TimeToString(now - 1000), Field.Store.YES, Field.Index.UN_TOKENIZED));
-			doc.Add(new Field("body", "Today is a very sunny day in New York City", Field.Store.YES, Field.Index.TOKENIZED));
+            doc.Add(new Field("datefield", Lucene.Net.Documents.DateTools.TimeToString(now - 1000, Lucene.Net.Documents.DateTools.Resolution.MILLISECOND), Field.Store.YES, Field.Index.UN_TOKENIZED));
+            doc.Add(new Field("body", "Today is a very sunny day in New York City", Field.Store.YES, Field.Index.TOKENIZED));
 			writer.AddDocument(doc);
 			writer.Optimize();
 			writer.Close();
@@ -59,10 +59,11 @@
 			IndexSearcher searcher = new IndexSearcher(indexStore);
 			
 			// filter that should preserve matches
-			DateFilter df1 = DateFilter.Before("datefield", now);
-			
-			// filter that should discard matches
-			DateFilter df2 = DateFilter.Before("datefield", now - 999999);
+			//DateFilter df1 = DateFilter.Before("datefield", now);
+            RangeFilter df1 = new RangeFilter("datefield", Lucene.Net.Documents.DateTools.TimeToString(now - 2000, Lucene.Net.Documents.DateTools.Resolution.MILLISECOND), Lucene.Net.Documents.DateTools.TimeToString(now, Lucene.Net.Documents.DateTools.Resolution.MILLISECOND), false, true);
+            // filter that should discard matches
+			//DateFilter df2 = DateFilter.Before("datefield", now - 999999);
+            RangeFilter df2 = new RangeFilter("datefield", Lucene.Net.Documents.DateTools.TimeToString(0, Lucene.Net.Documents.DateTools.Resolution.MILLISECOND), Lucene.Net.Documents.DateTools.TimeToString(now - 2000, Lucene.Net.Documents.DateTools.Resolution.MILLISECOND), true, false);
 			
 			// search something that doesn't exist with DateFilter
 			Query query1 = new TermQuery(new Term("body", "NoMatchForThis"));
@@ -106,8 +107,8 @@
 			
 			Lucene.Net.Documents.Document doc = new Lucene.Net.Documents.Document();
 			// add time that is in the future
-			doc.Add(new Field("datefield", DateField.TimeToString(now + 888888), Field.Store.YES, Field.Index.UN_TOKENIZED));
-			doc.Add(new Field("body", "Today is a very sunny day in New York City", Field.Store.YES, Field.Index.TOKENIZED));
+            doc.Add(new Field("datefield", Lucene.Net.Documents.DateTools.TimeToString(now + 888888, Lucene.Net.Documents.DateTools.Resolution.MILLISECOND), Field.Store.YES, Field.Index.UN_TOKENIZED));
+            doc.Add(new Field("body", "Today is a very sunny day in New York City", Field.Store.YES, Field.Index.TOKENIZED));
 			writer.AddDocument(doc);
 			writer.Optimize();
 			writer.Close();
@@ -115,10 +116,11 @@
 			IndexSearcher searcher = new IndexSearcher(indexStore);
 			
 			// filter that should preserve matches
-			DateFilter df1 = DateFilter.After("datefield", now);
-			
-			// filter that should discard matches
-			DateFilter df2 = DateFilter.After("datefield", now + 999999);
+			//DateFilter df1 = DateFilter.After("datefield", now);
+            RangeFilter df1 = new RangeFilter("datefield", Lucene.Net.Documents.DateTools.TimeToString(now, Lucene.Net.Documents.DateTools.Resolution.MILLISECOND), Lucene.Net.Documents.DateTools.TimeToString(now + 999999, Lucene.Net.Documents.DateTools.Resolution.MILLISECOND), true, false);
+            // filter that should discard matches
+			//DateFilter df2 = DateFilter.After("datefield", now + 999999);
+            RangeFilter df2 = new RangeFilter("datefield", Lucene.Net.Documents.DateTools.TimeToString(now + 999999, Lucene.Net.Documents.DateTools.Resolution.MILLISECOND), Lucene.Net.Documents.DateTools.TimeToString(now + 999999999, Lucene.Net.Documents.DateTools.Resolution.MILLISECOND), false, true);
 			
 			// search something that doesn't exist with DateFilter
 			Query query1 = new TermQuery(new Term("body", "NoMatchForThis"));

Modified: incubator/lucene.net/trunk/C#/src/Test/Search/TestDisjunctionMaxQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Search/TestDisjunctionMaxQuery.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Search/TestDisjunctionMaxQuery.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Search/TestDisjunctionMaxQuery.cs Thu Aug 17 06:49:26 2006
@@ -98,39 +98,39 @@
 			// d1 is an "ok" match for:  albino elephant
 			{
 				Lucene.Net.Documents.Document d1 = new Lucene.Net.Documents.Document();
-				d1.Add(Field.Keyword("id", "d1"));
-				d1.Add(Field.Text("hed", "elephant"));
-				d1.Add(Field.Text("dek", "elephant"));
-				writer.AddDocument(d1);
+                d1.Add(new Field("id", "d1", Field.Store.YES, Field.Index.UN_TOKENIZED)); //Field.Keyword("id", "d1"));
+                d1.Add(new Field("hed", "elephant", Field.Store.YES, Field.Index.TOKENIZED)); //Field.Text("hed", "elephant"));
+                d1.Add(new Field("dek", "elephant", Field.Store.YES, Field.Index.TOKENIZED)); //Field.Text("dek", "elephant"));
+                writer.AddDocument(d1);
 			}
 			
 			// d2 is a "good" match for:  albino elephant
 			{
 				Lucene.Net.Documents.Document d2 = new Lucene.Net.Documents.Document();
-				d2.Add(Field.Keyword("id", "d2"));
-				d2.Add(Field.Text("hed", "elephant"));
-				d2.Add(Field.Text("dek", "albino"));
-				d2.Add(Field.Text("dek", "elephant"));
-				writer.AddDocument(d2);
+                d2.Add(new Field("id", "d2", Field.Store.YES, Field.Index.UN_TOKENIZED)); //Field.Keyword("id", "d2"));
+                d2.Add(new Field("hed", "elephant", Field.Store.YES, Field.Index.TOKENIZED)); //Field.Text("hed", "elephant"));
+                d2.Add(new Field("dek", "albino", Field.Store.YES, Field.Index.TOKENIZED)); //Field.Text("dek", "albino"));
+                d2.Add(new Field("dek", "elephant", Field.Store.YES, Field.Index.TOKENIZED)); //Field.Text("dek", "elephant"));
+                writer.AddDocument(d2);
 			}
 			
 			// d3 is a "better" match for:  albino elephant
 			{
 				Lucene.Net.Documents.Document d3 = new Lucene.Net.Documents.Document();
-				d3.Add(Field.Keyword("id", "d3"));
-				d3.Add(Field.Text("hed", "albino"));
-				d3.Add(Field.Text("hed", "elephant"));
-				writer.AddDocument(d3);
+                d3.Add(new Field("id", "d3", Field.Store.YES, Field.Index.UN_TOKENIZED)); //Field.Keyword("id", "d3"));
+                d3.Add(new Field("hed", "albino", Field.Store.YES, Field.Index.TOKENIZED)); //Field.Text("hed", "albino"));
+                d3.Add(new Field("hed", "elephant", Field.Store.YES, Field.Index.TOKENIZED)); //Field.Text("hed", "elephant"));
+                writer.AddDocument(d3);
 			}
 			
 			// d4 is the "best" match for:  albino elephant
 			{
 				Lucene.Net.Documents.Document d4 = new Lucene.Net.Documents.Document();
-				d4.Add(Field.Keyword("id", "d4"));
-				d4.Add(Field.Text("hed", "albino"));
-				d4.Add(Field.Text("hed", "elephant"));
-				d4.Add(Field.Text("dek", "albino"));
-				writer.AddDocument(d4);
+                d4.Add(new Field("id", "d4", Field.Store.YES, Field.Index.UN_TOKENIZED)); //Field.Keyword("id", "d4"));
+                d4.Add(new Field("hed", "albino", Field.Store.YES, Field.Index.TOKENIZED)); //Field.Text("hed", "albino"));
+                d4.Add(new Field("hed", "elephant", Field.Store.YES, Field.Index.TOKENIZED)); //Field.Text("hed", "elephant"));
+                d4.Add(new Field("dek", "albino", Field.Store.YES, Field.Index.TOKENIZED)); //Field.Text("dek", "albino"));
+                writer.AddDocument(d4);
 			}
 			
 			writer.Close();
@@ -257,14 +257,14 @@
 				DisjunctionMaxQuery q1 = new DisjunctionMaxQuery(0.0f);
 				q1.Add(Tq("hed", "albino"));
 				q1.Add(Tq("dek", "albino"));
-				q.Add(q1, true, false);
-			}
+                q.Add(q1, BooleanClause.Occur.SHOULD); //false,false);
+            }
 			{
 				DisjunctionMaxQuery q2 = new DisjunctionMaxQuery(0.0f);
 				q2.Add(Tq("hed", "elephant"));
 				q2.Add(Tq("dek", "elephant"));
-				q.Add(q2, true, false);
-			}
+                q.Add(q2, BooleanClause.Occur.SHOULD); //false,false);
+            }
 			
 			
 			Hits h = s.Search(q);
@@ -294,14 +294,14 @@
 				DisjunctionMaxQuery q1 = new DisjunctionMaxQuery(0.0f);
 				q1.Add(Tq("hed", "albino"));
 				q1.Add(Tq("dek", "albino"));
-				q.Add(q1, false, false);
-			}
+                q.Add(q1, BooleanClause.Occur.SHOULD); //false,false);
+            }
 			{
 				DisjunctionMaxQuery q2 = new DisjunctionMaxQuery(0.0f);
 				q2.Add(Tq("hed", "elephant"));
 				q2.Add(Tq("dek", "elephant"));
-				q.Add(q2, false, false);
-			}
+                q.Add(q2, BooleanClause.Occur.SHOULD); //false,false);
+            }
 			
 			
 			Hits h = s.Search(q);
@@ -335,14 +335,14 @@
 				DisjunctionMaxQuery q1 = new DisjunctionMaxQuery(0.01f);
 				q1.Add(Tq("hed", "albino"));
 				q1.Add(Tq("dek", "albino"));
-				q.Add(q1, false, false);
-			}
+                q.Add(q1, BooleanClause.Occur.SHOULD); //false,false);
+            }
 			{
 				DisjunctionMaxQuery q2 = new DisjunctionMaxQuery(0.01f);
 				q2.Add(Tq("hed", "elephant"));
 				q2.Add(Tq("dek", "elephant"));
-				q.Add(q2, false, false);
-			}
+                q.Add(q2, BooleanClause.Occur.SHOULD); //false,false);
+            }
 			
 			
 			Hits h = s.Search(q);
@@ -387,14 +387,14 @@
 				DisjunctionMaxQuery q1 = new DisjunctionMaxQuery(0.01f);
 				q1.Add(Tq("hed", "albino", 1.5f));
 				q1.Add(Tq("dek", "albino"));
-				q.Add(q1, false, false);
-			}
+                q.Add(q1, BooleanClause.Occur.SHOULD); //false,false);
+            }
 			{
 				DisjunctionMaxQuery q2 = new DisjunctionMaxQuery(0.01f);
 				q2.Add(Tq("hed", "elephant", 1.5f));
 				q2.Add(Tq("dek", "elephant"));
-				q.Add(q2, false, false);
-			}
+                q.Add(q2, BooleanClause.Occur.SHOULD); //false,false);
+            }
 			
 			
 			Hits h = s.Search(q);
@@ -459,8 +459,8 @@
 			{
 				Lucene.Net.Documents.Document d = h.Doc(i);
 				float score = h.Score(i);
-				System.Console.Error.WriteLine("#" + i + ": {0.000000000}" + score + " - " + d.Get("id"));
-			}
+                System.Console.Error.WriteLine("#" + i + ": {0.000000000}" + score + " - " + d.Get("id"));
+            }
 		}
 	}
 }

Modified: incubator/lucene.net/trunk/C#/src/Test/Search/TestMatchAllDocsQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Search/TestMatchAllDocsQuery.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Search/TestMatchAllDocsQuery.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Search/TestMatchAllDocsQuery.cs Thu Aug 17 06:49:26 2006
@@ -63,7 +63,7 @@
 			Assert.AreEqual(1, hits.Length());
 			
 			// delete a document:
-			is_Renamed.GetIndexReader().Delete(0);
+			is_Renamed.GetIndexReader().DeleteDocument(0);
 			hits = is_Renamed.Search(new MatchAllDocsQuery());
 			Assert.AreEqual(2, hits.Length());
 			

Modified: incubator/lucene.net/trunk/C#/src/Test/Search/TestMultiSearcher.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Search/TestMultiSearcher.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Search/TestMultiSearcher.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Search/TestMultiSearcher.cs Thu Aug 17 06:49:26 2006
@@ -92,7 +92,8 @@
 			writerB.Close();
 			
 			// creating the query
-			Query query = Lucene.Net.QueryParsers.QueryParser.Parse("handle:1", "fulltext", new StandardAnalyzer());
+            Lucene.Net.QueryParsers.QueryParser parser = new Lucene.Net.QueryParsers.QueryParser("fulltext", new StandardAnalyzer());
+            Query query = parser.Parse("handle:1");
 			
 			// building the searchables
 			Searcher[] searchers = new Searcher[2];
@@ -151,7 +152,7 @@
 			// deleting the document just added, this will cause a different exception to take place
 			Term term = new Term("id", "doc1");
 			IndexReader readerB = IndexReader.Open(indexStoreB);
-			readerB.Delete(term);
+			readerB.DeleteDocuments(term);
 			readerB.Close();
 			
 			// optimizing the index with the writer

Modified: incubator/lucene.net/trunk/C#/src/Test/Search/TestMultiSearcherRanking.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Search/TestMultiSearcherRanking.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Search/TestMultiSearcherRanking.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Search/TestMultiSearcherRanking.cs Thu Aug 17 06:49:26 2006
@@ -105,8 +105,9 @@
 			// check result hit ranking
 			if (verbose)
 				System.Console.Out.WriteLine("Query: " + queryStr);
-			Query query = Lucene.Net.QueryParsers.QueryParser.Parse(queryStr, FIELD_NAME, new StandardAnalyzer());
-			Hits multiSearcherHits = multiSearcher.Search(query);
+            Lucene.Net.QueryParsers.QueryParser queryParser = new Lucene.Net.QueryParsers.QueryParser(FIELD_NAME, new StandardAnalyzer());
+            Lucene.Net.Search.Query query = queryParser.Parse(queryStr);
+            Hits multiSearcherHits = multiSearcher.Search(query);
 			Hits singleSearcherHits = singleSearcher.Search(query);
 			Assert.AreEqual(multiSearcherHits.Length(), singleSearcherHits.Length());
 			for (int i = 0; i < multiSearcherHits.Length(); i++)

Modified: incubator/lucene.net/trunk/C#/src/Test/Search/TestNot.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Search/TestNot.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Search/TestNot.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Search/TestNot.cs Thu Aug 17 06:49:26 2006
@@ -51,8 +51,9 @@
 			writer.Close();
 			
 			Searcher searcher = new IndexSearcher(store);
-			Query query = Lucene.Net.QueryParsers.QueryParser.Parse("a NOT b", "field", new SimpleAnalyzer());
-			//System.out.println(query);
+            Lucene.Net.QueryParsers.QueryParser parser = new Lucene.Net.QueryParsers.QueryParser("field", new SimpleAnalyzer());
+            Lucene.Net.Search.Query query = parser.Parse("a NOT b");
+            //System.out.println(query);
 			Hits hits = searcher.Search(query);
 			Assert.AreEqual(0, hits.Length());
 		}

Modified: incubator/lucene.net/trunk/C#/src/Test/Search/TestPhrasePrefixQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Search/TestPhrasePrefixQuery.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Search/TestPhrasePrefixQuery.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Search/TestPhrasePrefixQuery.cs Thu Aug 17 06:49:26 2006
@@ -65,9 +65,11 @@
 			
 			IndexSearcher searcher = new IndexSearcher(indexStore);
 			
-			PhrasePrefixQuery query1 = new PhrasePrefixQuery();
-			PhrasePrefixQuery query2 = new PhrasePrefixQuery();
-			query1.Add(new Term("body", "blueberry"));
+			//PhrasePrefixQuery query1 = new PhrasePrefixQuery();
+            MultiPhraseQuery query1 = new MultiPhraseQuery();
+            //PhrasePrefixQuery query2 = new PhrasePrefixQuery();
+            MultiPhraseQuery query2 = new MultiPhraseQuery();
+            query1.Add(new Term("body", "blueberry"));
 			query2.Add(new Term("body", "strawberry"));
 			
 			System.Collections.ArrayList termsWithPrefix = new System.Collections.ArrayList();

Modified: incubator/lucene.net/trunk/C#/src/Test/Search/TestPhraseQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Search/TestPhraseQuery.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Search/TestPhraseQuery.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Search/TestPhraseQuery.cs Thu Aug 17 06:49:26 2006
@@ -79,8 +79,6 @@
 		[SetUp]
         public virtual void  SetUp()
 		{
-            System.Console.Out.WriteLine("Setup()");
-
 			directory = new RAMDirectory();
 			Analyzer analyzer = new AnonymousClassAnalyzer(this);
 			IndexWriter writer = new IndexWriter(directory, analyzer, true);
@@ -102,8 +100,6 @@
 		[TearDown]
         public virtual void  TearDown()
 		{
-            System.Console.Out.WriteLine("TearDown()");
-
 			searcher.Close();
 			directory.Close();
 		}
@@ -111,8 +107,6 @@
 		[Test]
         public virtual void  TestNotCloseEnough()
 		{
-            System.Console.Out.WriteLine("TestNotCloseEnough()");
-
 			query.SetSlop(2);
 			query.Add(new Term("field", "one"));
 			query.Add(new Term("field", "five"));
@@ -123,8 +117,6 @@
 		[Test]
         public virtual void  TestBarelyCloseEnough()
 		{
-            System.Console.Out.WriteLine("TestBarelyCloseEnough()");
-
 			query.SetSlop(3);
 			query.Add(new Term("field", "one"));
 			query.Add(new Term("field", "five"));
@@ -136,8 +128,6 @@
 		[Test]
         public virtual void  TestExact()
 		{
-            System.Console.Out.WriteLine("TestExact()");
-
 			// slop is zero by default
 			query.Add(new Term("field", "four"));
 			query.Add(new Term("field", "five"));
@@ -154,8 +144,6 @@
 		[Test]
         public virtual void  TestSlop1()
 		{
-            System.Console.Out.WriteLine("TestSlop1()");
-
 			// Ensures slop of 1 works with terms in order.
 			query.SetSlop(1);
 			query.Add(new Term("field", "one"));
@@ -177,8 +165,6 @@
 		[Test]
         public virtual void  TestOrderDoesntMatter()
 		{
-            System.Console.Out.WriteLine("TestOrderDoesntMatter()");
-
 			query.SetSlop(2); // must be at least two for reverse order match
 			query.Add(new Term("field", "two"));
 			query.Add(new Term("field", "one"));
@@ -199,8 +185,6 @@
 		[Test]
         public virtual void  TestMulipleTerms()
 		{
-            System.Console.Out.WriteLine("TestMulipleTerms()");
-
 			query.SetSlop(2);
 			query.Add(new Term("field", "one"));
 			query.Add(new Term("field", "three"));
@@ -224,8 +208,6 @@
 		[Test]
         public virtual void  TestPhraseQueryWithStopAnalyzer()
 		{
-            System.Console.Out.WriteLine("TestPhraseQueryWithStopAnalyzer()");
-
 			RAMDirectory directory = new RAMDirectory();
 			StopAnalyzer stopAnalyzer = new StopAnalyzer();
 			IndexWriter writer = new IndexWriter(directory, stopAnalyzer, true);
@@ -256,8 +238,6 @@
 		[Test]
         public virtual void  TestPhraseQueryInConjunctionScorer()
 		{
-            System.Console.Out.WriteLine("TestPhraseQueryInConjunctionScorer()");
-
 			RAMDirectory directory = new RAMDirectory();
 			IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(), true);
 			
@@ -337,8 +317,6 @@
 		[Test]
         public virtual void  TestSlopScoring()
 		{
-            System.Console.Out.WriteLine("TestSlopScoring()");
-
 			Directory directory = new RAMDirectory();
 			IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(), true);
 			
@@ -377,8 +355,6 @@
 		[Test]
         public virtual void  TestWrappedPhrase()
 		{
-            System.Console.Out.WriteLine("TestWrappedPhrase()");
-
 			query.Add(new Term("repeated", "first"));
 			query.Add(new Term("repeated", "part"));
 			query.Add(new Term("repeated", "second"));

Modified: incubator/lucene.net/trunk/C#/src/Test/Search/TestRemoteSearchable.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Search/TestRemoteSearchable.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Search/TestRemoteSearchable.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Search/TestRemoteSearchable.cs Thu Aug 17 06:49:26 2006
@@ -114,5 +114,15 @@
 			Hits nohits = searcher.Search(new TermQuery(new Term("test", "text")), new QueryFilter(new TermQuery(new Term("test", "non-existent-term"))));
 			Assert.AreEqual(0, nohits.Length());
 		}
-	}
+		
+        [Test]
+        public virtual void  TestConstantScoreQuery()
+        {
+            // try to search the published index
+            Lucene.Net.Search.Searchable[] searchables = new Lucene.Net.Search.Searchable[]{GetRemote()};
+            Searcher searcher = new MultiSearcher(searchables);
+            Hits hits = searcher.Search(new ConstantScoreQuery(new QueryFilter(new TermQuery(new Term("test", "test")))));
+            Assert.AreEqual(1, hits.Length());
+        }
+    }
 }

Modified: incubator/lucene.net/trunk/C#/src/Test/Search/TestSort.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Search/TestSort.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Search/TestSort.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Search/TestSort.cs Thu Aug 17 06:49:26 2006
@@ -120,13 +120,14 @@
 		}
 		
 		
-		// document data:
-		// the tracer field is used to determine which document was hit
-		// the contents field is used to search and sort by relevance
-		// the int field to sort by int
-		// the float field to sort by float
-		// the string field to sort by string
-		private System.String[][] data = new System.String[][]{new System.String[]{"A", "x a", "5", "4f", "c", "A-3"}, new System.String[]{"B", "y a", "5", "3.4028235E38", "i", "B-10"}, new System.String[]{"C", "x a b c", "2147483647", "1.0", "j", "A-2"}, new System.String[]{"D", "y a b c", "-1", "0.0f", "a", "C-0"}, new System.String[]{"E", "x a b c d", "5", "2f", "h", "B-8"}, new System.String[]{"F", "y a b c d", "2", "3.14159f", "g", "B-1"}, new System.String[]{"G", "x a b c d", "3", "-1.0", "f", "C-100"}, new System.String[]{"H", "y a b c d", "0", "1.4E-45", "e", "C-88"}, new System.String[]{"I", "x a b c d e f", "-2147483648", "1.0e+0", "d", "A-10"}, new System.String[]{"J", "y a b c d e f", "4", ".5", "b", "C-7"}, new System.String[]{"W", "g", "1", null, null, null}, new System.String[]{"X", "g", "1", "0.1", null, null}, new System.String[]{"Y", "g", "1", "0.2", null, null}, new System.String[]{"Z", "f g", null, null, null, null}};
+        // document data:
+        // the tracer field is used to determine which document was hit
+        // the contents field is used to search and sort by relevance
+        // the int field to sort by int
+        // the float field to sort by float
+        // the string field to sort by string
+        // the i18n field includes accented characters for testing locale-specific sorting
+        private System.String[][] data = new System.String[][]{new System.String[]{"A", "x a", "5", "4f", "c", "A-3", "p\u00EAche"}, new System.String[]{"B", "y a", "5", "3.4028235E38", "i", "B-10", "HAT"}, new System.String[]{"C", "x a b c", "2147483647", "1.0", "j", "A-2", "p\u00E9ch\u00E9"}, new System.String[]{"D", "y a b c", "-1", "0.0f", "a", "C-0", "HUT"}, new System.String[]{"E", "x a b c d", "5", "2f", "h", "B-8", "peach"}, new System.String[]{"F", "y a b c d", "2", "3.14159f", "g", "B-1", "H\u00C5T"}, new System.String[]{"G", "x a b c d", "3", "-1.0", "f", "C-100", "sin"}, new System.String[]{"H", "y a b c d", "0", "1.4E-45", "e", "C-88", "H\u00D8T"}, new System.String[]{"I", "x a b c d e f", "-2147483648", "1.0e+0", "d", "A-10", "s\u00EDn"}, new System.String[]{"J", "y a b c d e f", "4", ".5", "b", "C-7", "HOT"}, new System.String[]{"W", "g", "1", null, null, null, null}, new System.String[]{"X", "g", "1", "0.1", null, null, null}, new System.String[]{"Y", "g", "1
 ", "0.2", null, null, null}, new System.String[]{"Z", "f g", null, null, null, null, null}};
 		
 		// create an index of all the documents, or just the x, or just the y documents
 		private Searcher GetIndex(bool even, bool odd)
@@ -148,7 +149,9 @@
 						doc.Add(new Field("string", data[i][4], Field.Store.NO, Field.Index.UN_TOKENIZED));
 					if (data[i][5] != null)
 						doc.Add(new Field("custom", data[i][5], Field.Store.NO, Field.Index.UN_TOKENIZED));
-					doc.SetBoost(2); // produce some scores above 1.0
+                    if (data[i][6] != null)
+                        doc.Add(new Field("i18n", data[i][6], Field.Store.NO, Field.Index.UN_TOKENIZED));
+                    doc.SetBoost(2); // produce some scores above 1.0
 					writer.AddDocument(doc);
 				}
 			}
@@ -369,7 +372,45 @@
 			AssertMatches(full, queryY, sort, "BFHJD");
 		}
 		
-		// test a custom sort function
+        // test using various international locales with accented characters
+        // (which sort differently depending on locale)
+        [Test]
+        public virtual void  TestInternationalSort()
+        {
+            sort.SetSort(new SortField("i18n", new System.Globalization.CultureInfo("en-US")));
+            AssertMatches(full, queryY, sort, "BFJDH");
+			
+            sort.SetSort(new SortField("i18n", new System.Globalization.CultureInfo("sv" + "-" + "se")));
+            AssertMatches(full, queryY, sort, "BJDFH");
+			
+            sort.SetSort(new SortField("i18n", new System.Globalization.CultureInfo("da" + "-" + "dk")));
+            AssertMatches(full, queryY, sort, "BJDHF");
+			
+            sort.SetSort(new SortField("i18n", new System.Globalization.CultureInfo("en-US")));
+            AssertMatches(full, queryX, sort, "ECAGI");
+			
+            sort.SetSort(new SortField("i18n", new System.Globalization.CultureInfo("fr-FR")));
+            AssertMatches(full, queryX, sort, "EACGI");
+        }
+		
+        // Test the MultiSearcher's ability to preserve locale-sensitive ordering
+        // by wrapping it around a single searcher
+        [Test]
+        public virtual void  TestInternationalMultiSearcherSort()
+        {
+            Searcher multiSearcher = new MultiSearcher(new Lucene.Net.Search.Searchable[]{full});
+			
+            sort.SetSort(new SortField("i18n", new System.Globalization.CultureInfo("sv" + "-" + "se")));
+            AssertMatches(multiSearcher, queryY, sort, "BJDFH");
+			
+            sort.SetSort(new SortField("i18n", new System.Globalization.CultureInfo("en-US")));
+            AssertMatches(multiSearcher, queryY, sort, "BFJDH");
+			
+            sort.SetSort(new SortField("i18n", new System.Globalization.CultureInfo("da" + "-" + "dk")));
+            AssertMatches(multiSearcher, queryY, sort, "BJDHF");
+        }
+		
+        // test a custom sort function
 		[Test]
         public virtual void  TestCustomSorts()
 		{



Mime
View raw message