You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by cc...@apache.org on 2011/11/19 00:05:14 UTC

[Lucene.Net] svn commit: r1203896 [2/2] - in /incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk: src/core/ src/core/Analysis/ src/core/Index/ src/core/Search/ src/core/Search/Function/ src/core/Search/Payloads/ src/core/Search/Spans/ src/core/Support/ test/core/...

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Lucene.Net.csproj
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Lucene.Net.csproj?rev=1203896&r1=1203895&r2=1203896&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Lucene.Net.csproj (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Lucene.Net.csproj Fri Nov 18 23:05:13 2011
@@ -278,7 +278,6 @@
     <Compile Include="Index\CorruptIndexException.cs" />
     <Compile Include="Index\DefaultSkipListReader.cs" />
     <Compile Include="Index\DefaultSkipListWriter.cs" />
-    <Compile Include="Index\DirectoryOwningReader.cs" />
     <Compile Include="Index\DirectoryReader.cs" />
     <Compile Include="Index\DocConsumer.cs" />
     <Compile Include="Index\DocConsumerPerThread.cs" />
@@ -530,9 +529,6 @@
     <Compile Include="Search\ConstantScoreQuery.cs">
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="Search\ConstantScoreRangeQuery.cs">
-      <SubType>Code</SubType>
-    </Compile>
     <Compile Include="Search\DefaultSimilarity.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -553,7 +549,6 @@
     <Compile Include="Search\Explanation.cs">
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="Search\ExtendedFieldCache.cs" />
     <Compile Include="Search\FieldCache.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -591,7 +586,6 @@
     <Compile Include="Search\Function\FieldScoreQuery.cs" />
     <Compile Include="Search\Function\FloatFieldSource.cs" />
     <Compile Include="Search\Function\IntFieldSource.cs" />
-    <Compile Include="Search\Function\MultiValueSource.cs" />
     <Compile Include="Search\Function\OrdFieldSource.cs" />
     <Compile Include="Search\Function\ReverseOrdFieldSource.cs" />
     <Compile Include="Search\Function\ShortFieldSource.cs" />
@@ -603,22 +597,9 @@
     <Compile Include="Search\FuzzyTermEnum.cs">
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="Search\Hit.cs">
-      <SubType>Code</SubType>
-    </Compile>
-    <Compile Include="Search\HitCollector.cs">
-      <SubType>Code</SubType>
-    </Compile>
-    <Compile Include="Search\HitCollectorWrapper.cs" />
-    <Compile Include="Search\HitIterator.cs">
-      <SubType>Code</SubType>
-    </Compile>
     <Compile Include="Search\HitQueue.cs">
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="Search\Hits.cs">
-      <SubType>Code</SubType>
-    </Compile>
     <Compile Include="Search\IndexSearcher.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -641,7 +622,6 @@
       <SubType>Code</SubType>
     </Compile>
     <Compile Include="Search\Payloads\AveragePayloadFunction.cs" />
-    <Compile Include="Search\Payloads\BoostingTermQuery.cs" />
     <Compile Include="Search\Payloads\MaxPayloadFunction.cs" />
     <Compile Include="Search\Payloads\MinPayloadFunction.cs" />
     <Compile Include="Search\Payloads\PayloadFunction.cs" />
@@ -671,9 +651,6 @@
     <Compile Include="Search\Query.cs">
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="Search\QueryFilter.cs">
-      <SubType>Code</SubType>
-    </Compile>
     <Compile Include="Search\QueryTermVector.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -688,9 +665,6 @@
     <Compile Include="Search\ScoreDoc.cs">
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="Search\ScoreDocComparator.cs">
-      <SubType>Code</SubType>
-    </Compile>
     <Compile Include="Search\Scorer.cs">
       <SubType>Code</SubType>
     </Compile>

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/BooleanScorer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/BooleanScorer.cs?rev=1203896&r1=1203895&r2=1203896&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/BooleanScorer.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/BooleanScorer.cs Fri Nov 18 23:05:13 2011
@@ -339,11 +339,6 @@ namespace Lucene.Net.Search
 		{
 			return doc;
 		}
-		
-		public override Explanation Explain(int doc)
-		{
-			throw new System.NotSupportedException();
-		}
 
 		public override int NextDoc()
 		{

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FuzzyQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FuzzyQuery.cs?rev=1203896&r1=1203895&r2=1203896&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FuzzyQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FuzzyQuery.cs Fri Nov 18 23:05:13 2011
@@ -16,6 +16,8 @@
  */
 
 using System;
+using System.Collections.Generic;
+using System.Linq;
 using Lucene.Net.Support;
 using Lucene.Net.Util;
 using IndexReader = Lucene.Net.Index.IndexReader;
@@ -139,39 +141,39 @@ namespace Lucene.Net.Search
 				return new TermQuery(term);
 			}
 
+		    int maxSize = BooleanQuery.GetMaxClauseCount();
+
+            // TODO: Java uses a PriorityQueue.  Using Linq, we can emulate it, 
+            //       however it's considerable slower than the java counterpart.
+            //       this should be a temporary thing, fixed before release
+            SortedList<ScoreTerm, ScoreTerm> stQueue = new SortedList<ScoreTerm, ScoreTerm>();
 			FilteredTermEnum enumerator = GetEnum(reader);
-			int maxClauseCount = BooleanQuery.GetMaxClauseCount();
-			ScoreTermQueue stQueue = new ScoreTermQueue(maxClauseCount);
-			ScoreTerm reusableST = null;
 			
 			try
 			{
+                ScoreTerm st = new ScoreTerm();
 				do 
 				{
-					float score = 0.0f;
 					Term t = enumerator.Term();
-					if (t != null)
-					{
-						score = enumerator.Difference();
-						if (reusableST == null)
-						{
-							reusableST = new ScoreTerm(t, score);
-						}
-						else if (score >= reusableST.score)
-						{
-							// reusableST holds the last "rejected" entry, so, if
-							// this new score is not better than that, there's no
-							// need to try inserting it
-							reusableST.score = score;
-							reusableST.term = t;
-						}
-						else
-						{
-							continue;
-						}
-						
-						reusableST = (ScoreTerm) stQueue.InsertWithOverflow(reusableST);
-					}
+                    if (t == null) break;
+				    float score = enumerator.Difference();
+                    //ignore uncompetetive hits
+                    if (stQueue.Count >= maxSize && score <= stQueue.Keys.First().score)
+                        continue;
+                    // add new entry in PQ
+				    st.term = t;
+				    st.score = score;
+				    stQueue.Add(st, st);
+                    // possibly drop entries from queue
+                    if (stQueue.Count > maxSize)
+                    {
+                        st = stQueue.Keys.First();
+                        stQueue.Remove(st);
+                    }
+                    else
+                    {
+                        st = new ScoreTerm();
+                    }
 				}
 				while (enumerator.Next());
 			}
@@ -181,10 +183,8 @@ namespace Lucene.Net.Search
 			}
 			
 			BooleanQuery query = new BooleanQuery(true);
-			int size = stQueue.Size();
-			for (int i = 0; i < size; i++)
+			foreach(ScoreTerm st in stQueue.Keys)
 			{
-				ScoreTerm st = (ScoreTerm) stQueue.Pop();
 				TermQuery tq = new TermQuery(st.term); // found a match
 				tq.SetBoost(GetBoost() * st.score); // set the boost
 				query.Add(tq, BooleanClause.Occur.SHOULD); // add to query
@@ -208,36 +208,22 @@ namespace Lucene.Net.Search
 			return buffer.ToString();
 		}
 		
-		protected internal class ScoreTerm
+		protected internal class ScoreTerm : IComparable<ScoreTerm>
 		{
 			public Term term;
 			public float score;
-			
-			public ScoreTerm(Term term, float score)
-			{
-				this.term = term;
-				this.score = score;
-			}
-		}
-		
-		protected internal class ScoreTermQueue:PriorityQueue<ScoreTerm>
-		{
-			
-			public ScoreTermQueue(int size)
-			{
-				Initialize(size);
-			}
-			
-			/* (non-Javadoc)
-			* <see cref="Lucene.Net.Util.PriorityQueue.lessThan(java.lang.Object, java.lang.Object)"/>
-			*/
-            public override bool LessThan(ScoreTerm termA, ScoreTerm termB)
-			{
-				if (termA.score == termB.score)
-					return termA.term.CompareTo(termB.term) > 0;
-				else
-					return termA.score < termB.score;
-			}
+
+		    public int CompareTo(ScoreTerm other)
+		    {
+                if (Comparer<float>.Default.Compare(this.score, other.score) == 0)
+                {
+                    return other.term.CompareTo(this.term);
+                }
+                else
+                {
+                    return Comparer<float>.Default.Compare(this.score, other.score);
+                }
+		    }
 		}
 		
 		public override int GetHashCode()

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FuzzyTermEnum.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FuzzyTermEnum.cs?rev=1203896&r1=1203895&r2=1203896&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FuzzyTermEnum.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FuzzyTermEnum.cs Fri Nov 18 23:05:13 2011
@@ -31,17 +31,11 @@ namespace Lucene.Net.Search
 	/// </summary>
 	public sealed class FuzzyTermEnum:FilteredTermEnum
 	{
-		
-		/* This should be somewhere around the average long word.
-		* If it is longer, we waste time and space. If it is shorter, we waste a
-		* little bit of time growing the array as we encounter longer words.
-		*/
-		private const int TYPICAL_LONGEST_WORD_IN_INDEX = 19;
-		
 		/* Allows us save time required to create a new array
 		* everytime similarity is called.
 		*/
-		private int[][] d;
+	    private int[] p;
+		private int[] d;
 		
 		private float similarity;
 		private bool endEnum = false;
@@ -53,7 +47,6 @@ namespace Lucene.Net.Search
 		
 		private float minimumSimilarity;
 		private float scale_factor;
-		private int[] maxDistances = new int[TYPICAL_LONGEST_WORD_IN_INDEX];
 		
 		/// <summary> Creates a FuzzyTermEnum with an empty prefix and a minSimilarity of 0.5f.
 		/// <p/>
@@ -130,9 +123,9 @@ namespace Lucene.Net.Search
 			
 			this.text = searchTerm.Text().Substring(realPrefixLength);
 			this.prefix = searchTerm.Text().Substring(0, (realPrefixLength) - (0));
-			
-			InitializeMaxDistances();
-			this.d = InitDistanceArray();
+
+		    this.p = new int[this.text.Length + 1];
+            this.d = new int[this.text.Length + 1];
 			
 			SetEnum(reader.Terms(new Term(searchTerm.Field(), prefix)));
 		}
@@ -154,7 +147,7 @@ namespace Lucene.Net.Search
 		
 		public override float Difference()
 		{
-			return (float) ((similarity - minimumSimilarity) * scale_factor);
+			return ((similarity - minimumSimilarity) * scale_factor);
 		}
 		
 		public override bool EndEnum()
@@ -168,28 +161,11 @@ namespace Lucene.Net.Search
 		// ****************************
 		// </summary>
 		
-		/// <summary> Finds and returns the smallest of three integers </summary>
-		private static int Min(int a, int b, int c)
-		{
-			int t = (a < b)?a:b;
-			return (t < c)?t:c;
-		}
-		
-		private int[][] InitDistanceArray()
-		{
-			int[][] tmpArray = new int[this.text.Length + 1][];
-			for (int i = 0; i < this.text.Length + 1; i++)
-			{
-				tmpArray[i] = new int[TYPICAL_LONGEST_WORD_IN_INDEX];
-			}
-			return tmpArray;
-		}
-		
 		/// <summary> <p/>Similarity returns a number that is 1.0f or less (including negative numbers)
 		/// based on how similar the Term is compared to a target term.  It returns
 		/// exactly 0.0f when
 		/// <c>
-		/// editDistance &lt; maximumEditDistance</c>  
+		/// editDistance &gt; maximumEditDistance</c>  
 		/// Otherwise it returns:
 		/// <c>
 		/// 1 - (editDistance / length)</c>
@@ -239,7 +215,7 @@ namespace Lucene.Net.Search
                 return prefix.Length == 0 ? 0.0f : 1.0f - ((float)n / prefix.Length);
             }
 
-            int maxDistance = GetMaxDistance(m);
+            int maxDistance = CalculateMaxDistance(m);
 
             if (maxDistance < System.Math.Abs(m - n))
             {
@@ -253,69 +229,62 @@ namespace Lucene.Net.Search
                 return 0.0f;
             }
 
-            //let's make sure we have enough room in our array to do the distance calculations.
-            if (d[0].Length <= m)
+            // init matrix d
+            for (int i = 0; i < n; ++i)
             {
-                GrowDistanceArray(m);
+                p[i] = i;
             }
 
-            // init matrix d
-            for (int i = 0; i <= n; i++)
-                d[i][0] = i;
-            for (int j = 0; j <= m; j++)
-                d[0][j] = j;
-
-            // start computing edit distance
-            for (int i = 1; i <= n; i++)
+                // start computing edit distance
+            for (int j = 1; j <= m; ++j)
             {
                 int bestPossibleEditDistance = m;
-                char s_i = text[i - 1];
-                for (int j = 1; j <= m; j++)
+                char t_j = target[j - 1];
+                d[0] = j;
+                for (int i = 1; i <= n; ++i)
                 {
-                    if (s_i != target[j - 1])
+                    // minimum of cell to the left+1, to the top+1, diagonally left and up +(0|1)
+                    if (t_j != text[i - 1])
                     {
-                        d[i][j] = Min(d[i - 1][j], d[i][j - 1], d[i - 1][j - 1]) + 1;
+                        d[i] = Math.Min(Math.Min(d[i - 1], p[i]), p[i - 1]) + 1;
                     }
                     else
                     {
-                        d[i][j] = Min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1]);
+                        d[i] = Math.Min(Math.Min(d[i - 1] + 1, p[i] + 1), p[i - 1]);
                     }
-                    bestPossibleEditDistance = System.Math.Min(bestPossibleEditDistance, d[i][j]);
+                    bestPossibleEditDistance = System.Math.Min(bestPossibleEditDistance, d[i]);
                 }
 
                 //After calculating row i, the best possible edit distance
                 //can be found by found by finding the smallest value in a given column.
                 //If the bestPossibleEditDistance is greater than the max distance, abort.
 
-                if (i > maxDistance && bestPossibleEditDistance > maxDistance)
+                if (j > maxDistance && bestPossibleEditDistance > maxDistance)
                 {
                     //equal is okay, but not greater
                     //the closest the target can be to the text is just too far away.
                     //this target is leaving the party early.
                     return 0.0f;
                 }
+
+                // copy current distance counts to 'previous row' distance counts: swap p and d
+                  int[] _d = p;
+                  p = d;
+                  d = _d;
             }
 
+            // our last action in the above loop was to switch d and p, so p now
+            // actually has the most recent cost counts
+
             // this will return less than 0.0 when the edit distance is
             // greater than the number of characters in the shorter word.
             // but this was the formula that was previously used in FuzzyTermEnum,
             // so it has not been changed (even though minimumSimilarity must be
             // greater than 0.0)
-            return 1.0f - ((float)d[n][m] / (float)(prefix.Length + System.Math.Min(n, m)));
+            return 1.0f - (p[n] / (float)(prefix.Length + System.Math.Min(n, m)));
 
         }
 		
-		/// <summary> Grow the second dimension of the array, so that we can calculate the
-		/// Levenshtein difference.
-		/// </summary>
-		private void  GrowDistanceArray(int m)
-		{
-			for (int i = 0; i < d.Length; i++)
-			{
-				d[i] = new int[m + 1];
-			}
-		}
-		
 		/// <summary> The max Distance is the maximum Levenshtein distance for the text
 		/// compared to some other value that results in score that is
 		/// better than the minimum similarity.
@@ -324,19 +293,6 @@ namespace Lucene.Net.Search
 		/// </param>
 		/// <returns> the maximum levenshtein distance that we care about
 		/// </returns>
-		private int GetMaxDistance(int m)
-		{
-			return (m < maxDistances.Length)?maxDistances[m]:CalculateMaxDistance(m);
-		}
-		
-		private void  InitializeMaxDistances()
-		{
-			for (int i = 0; i < maxDistances.Length; i++)
-			{
-				maxDistances[i] = CalculateMaxDistance(i);
-			}
-		}
-		
 		private int CalculateMaxDistance(int m)
 		{
 			return (int) ((1 - minimumSimilarity) * (System.Math.Min(text.Length, m) + prefix.Length));
@@ -344,6 +300,9 @@ namespace Lucene.Net.Search
 		
 		public override void  Close()
 		{
+		    p = null;
+		    d = null;
+		    searchTerm = null;
 			base.Close(); //call super.close() and let the garbage collector do its work.
 		}
 	}

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Package.html
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Package.html?rev=1203896&r1=1203895&r2=1203896&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Package.html (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Package.html Fri Nov 18 23:05:13 2011
@@ -1,389 +1,389 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements.  See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You 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.
--->
-<html>
-<head>
-   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-</head>
-<body>
-Code to search indices.
-
-<h2>Table Of Contents</h2>
-<p>
-    <ol>
-        <li><a href = "#search">Search Basics</a></li>
-        <li><a href = "#query">The Query Classes</a></li>
-        <li><a href = "#scoring">Changing the Scoring</a></li>
-    </ol>
-</p>
-<a name = "search"></a>
-<h2>Search</h2>
-<p>
-Search over indices.
-
-Applications usually call {@link
-Lucene.Net.Search.Searcher#search(Query)} or {@link
-Lucene.Net.Search.Searcher#search(Query,Filter)}.
-
-    <!-- FILL IN MORE HERE -->   
-</p>
-<a name = "query"></a>
-<h2>Query Classes</h2>
-<h4>
-    <a href = "TermQuery.html">TermQuery</a>
-</h4>
-
-<p>Of the various implementations of
-    <a href = "Query.html">Query</a>, the
-    <a href = "TermQuery.html">TermQuery</a>
-    is the easiest to understand and the most often used in applications. A <a
-        href="TermQuery.html">TermQuery</a> matches all the documents that contain the
-    specified
-    <a href = "index/Term.html">Term</a>,
-    which is a word that occurs in a certain
-    <a href = "document/Field.html">Field</a>.
-    Thus, a <a href = "TermQuery.html">TermQuery</a> identifies and scores all
-    <a href = "document/Document.html">Document</a>s that have a <a
-        href="../document/Field.html">Field</a> with the specified string in it.
-    Constructing a <a
-        href="TermQuery.html">TermQuery</a>
-    is as simple as:
-    <pre>
-        TermQuery tq = new TermQuery(new Term("fieldName", "term"));
-    </pre>In this example, the <a href = "Query.html">Query</a> identifies all <a
-        href="../document/Document.html">Document</a>s that have the <a
-        href="../document/Field.html">Field</a> named <tt>"fieldName"</tt>
-    containing the word <tt>"term"</tt>.
-</p>
-<h4>
-    <a href = "BooleanQuery.html">BooleanQuery</a>
-</h4>
-
-<p>Things start to get interesting when one combines multiple
-    <a href = "TermQuery.html">TermQuery</a> instances into a <a
-        href="BooleanQuery.html">BooleanQuery</a>.
-    A <a href = "BooleanQuery.html">BooleanQuery</a> contains multiple
-    <a href = "BooleanClause.html">BooleanClause</a>s,
-    where each clause contains a sub-query (<a href = "Query.html">Query</a>
-    instance) and an operator (from <a
-        href="BooleanClause.Occur.html">BooleanClause.Occur</a>)
-    describing how that sub-query is combined with the other clauses:
-    <ol>
-
-        <li><p>SHOULD &mdash; Use this operator when a clause can occur in the result set, but is not required.
-            If a query is made up of all SHOULD clauses, then every document in the result
-            set matches at least one of these clauses.</p></li>
-
-        <li><p>MUST &mdash; Use this operator when a clause is required to occur in the result set. Every
-            document in the result set will match
-            all such clauses.</p></li>
-
-        <li><p>MUST NOT &mdash; Use this operator when a
-            clause must not occur in the result set. No
-            document in the result set will match
-            any such clauses.</p></li>
-    </ol>
-    Boolean queries are constructed by adding two or more
-    <a href = "BooleanClause.html">BooleanClause</a>
-    instances. If too many clauses are added, a <a href = "BooleanQuery.TooManyClauses.html">TooManyClauses</a>
-    exception will be thrown during searching. This most often occurs
-    when a <a href = "Query.html">Query</a>
-    is rewritten into a <a href = "BooleanQuery.html">BooleanQuery</a> with many
-    <a href = "TermQuery.html">TermQuery</a> clauses,
-    for example by <a href = "WildcardQuery.html">WildcardQuery</a>.
-    The default setting for the maximum number
-    of clauses 1024, but this can be changed via the
-    static method <a href = "BooleanQuery.html#setMaxClauseCount(int)">setMaxClauseCount</a>
-    in <a href = "BooleanQuery.html">BooleanQuery</a>.
-</p>
-
-<h4>Phrases</h4>
-
-<p>Another common search is to find documents containing certain phrases. This
-    is handled two different ways:
-    <ol>
-        <li>
-            <p><a href = "PhraseQuery.html">PhraseQuery</a>
-                &mdash; Matches a sequence of
-                <a href = "index/Term.html">Terms</a>.
-                <a href = "PhraseQuery.html">PhraseQuery</a> uses a slop factor to determine
-                how many positions may occur between any two terms in the phrase and still be considered a match.</p>
-        </li>
-        <li>
-            <p><a href = "spans/SpanNearQuery.html">SpanNearQuery</a>
-                &mdash; Matches a sequence of other
-                <a href = "spans/SpanQuery.html">SpanQuery</a>
-                instances. <a href = "spans/SpanNearQuery.html">SpanNearQuery</a> allows for
-                much more
-                complicated phrase queries since it is constructed from other <a
-                    href="spans/SpanQuery.html">SpanQuery</a>
-                instances, instead of only <a href = "TermQuery.html">TermQuery</a>
-                instances.</p>
-        </li>
-    </ol>
-</p>
-
-<h4>
-    <a href = "TermRangeQuery.html">TermRangeQuery</a>
-</h4>
-
-<p>The
-    <a href = "TermRangeQuery.html">TermRangeQuery</a>
-    matches all documents that occur in the
-    exclusive range of a lower
-    <a href = "index/Term.html">Term</a>
-    and an upper
-    <a href = "index/Term.html">Term</a>.
-    according to {@link java.lang.String#compareTo(String)}. It is not intended
-    for numerical ranges, use <a href = "NumericRangeQuery.html">NumericRangeQuery</a> instead.
-
-    For example, one could find all documents
-    that have terms beginning with the letters <tt>a</tt> through <tt>c</tt>. This type of <a
-        href="Query.html">Query</a> is frequently used to
-    find
-    documents that occur in a specific date range.
-</p>
-
-<h4>
-    <a href = "NumericRangeQuery.html">NumericRangeQuery</a>
-</h4>
-
-<p>The
-    <a href = "NumericRangeQuery.html">NumericRangeQuery</a>
-    matches all documents that occur in a numeric range.
-    For NumericRangeQuery to work, you must index the values
-    using a special <a href = "document/NumericField.html">
-    NumericField</a>.
-</p>
-
-<h4>
-    <a href = "PrefixQuery.html">PrefixQuery</a>,
-    <a href = "WildcardQuery.html">WildcardQuery</a>
-</h4>
-
-<p>While the
-    <a href = "PrefixQuery.html">PrefixQuery</a>
-    has a different implementation, it is essentially a special case of the
-    <a href = "WildcardQuery.html">WildcardQuery</a>.
-    The <a href = "PrefixQuery.html">PrefixQuery</a> allows an application
-    to identify all documents with terms that begin with a certain string. The <a
-        href="WildcardQuery.html">WildcardQuery</a> generalizes this by allowing
-    for the use of <tt>*</tt> (matches 0 or more characters) and <tt>?</tt> (matches exactly one character) wildcards.
-    Note that the <a href = "WildcardQuery.html">WildcardQuery</a> can be quite slow. Also
-    note that
-    <a href = "WildcardQuery.html">WildcardQuery</a> should
-    not start with <tt>*</tt> and <tt>?</tt>, as these are extremely slow. 
-	To remove this protection and allow a wildcard at the beginning of a term, see method
-	<a href = "queryParser/QueryParser.html#setAllowLeadingWildcard(boolean)">setAllowLeadingWildcard</a> in 
-	<a href = "queryParser/QueryParser.html">QueryParser</a>.
-</p>
-<h4>
-    <a href = "FuzzyQuery.html">FuzzyQuery</a>
-</h4>
-
-<p>A
-    <a href = "FuzzyQuery.html">FuzzyQuery</a>
-    matches documents that contain terms similar to the specified term. Similarity is
-    determined using
-    <a href = "http://en.wikipedia.org//wiki/Levenshtein">Levenshtein (edit) distance</a>.
-    This type of query can be useful when accounting for spelling variations in the collection.
-</p>
-<a name = "changingSimilarity"></a>
-<h2>Changing Similarity</h2>
-
-<p>Chances are <a href = "DefaultSimilarity.html">DefaultSimilarity</a> is sufficient for all
-    your searching needs.
-    However, in some applications it may be necessary to customize your <a
-        href="Similarity.html">Similarity</a> implementation. For instance, some
-    applications do not need to
-    distinguish between shorter and longer documents (see <a
-        href="http://www.gossamer-threads.com/lists/lucene/java-user/38967#38967">a "fair" similarity</a>).</p>
-
-<p>To change <a href = "Similarity.html">Similarity</a>, one must do so for both indexing and
-    searching, and the changes must happen before
-    either of these actions take place. Although in theory there is nothing stopping you from changing mid-stream, it
-    just isn't well-defined what is going to happen.
-</p>
-
-<p>To make this change, implement your own <a href = "Similarity.html">Similarity</a> (likely
-    you'll want to simply subclass
-    <a href = "DefaultSimilarity.html">DefaultSimilarity</a>) and then use the new
-    class by calling
-    <a href = "index/IndexWriter.html#setSimilarity(Lucene.Net.Search.Similarity)">IndexWriter.setSimilarity</a>
-    before indexing and
-    <a href = "Searcher.html#setSimilarity(Lucene.Net.Search.Similarity)">Searcher.setSimilarity</a>
-    before searching.
-</p>
-
-<p>
-    If you are interested in use cases for changing your similarity, see the Lucene users's mailing list at <a
-        href="http://www.nabble.com/Overriding-Similarity-tf2128934.html">Overriding Similarity</a>.
-    In summary, here are a few use cases:
-    <ol>
-        <li><p><a href = "api/org/apache/lucene/misc/SweetSpotSimilarity.html">SweetSpotSimilarity</a> &mdash; <a
-                href="api/org/apache/lucene/misc/SweetSpotSimilarity.html">SweetSpotSimilarity</a> gives small increases
-            as the frequency increases a small amount
-            and then greater increases when you hit the "sweet spot", i.e. where you think the frequency of terms is
-            more significant.</p></li>
-        <li><p>Overriding tf &mdash; In some applications, it doesn't matter what the score of a document is as long as a
-            matching term occurs. In these
-            cases people have overridden Similarity to return 1 from the tf() method.</p></li>
-        <li><p>Changing Length Normalization &mdash; By overriding <a
-                href="Similarity.html#lengthNorm(java.lang.String,%20int)">lengthNorm</a>,
-            it is possible to discount how the length of a field contributes
-            to a score. In <a href = "DefaultSimilarity.html">DefaultSimilarity</a>,
-            lengthNorm = 1 / (numTerms in field)^0.5, but if one changes this to be
-            1 / (numTerms in field), all fields will be treated
-            <a href = "http://www.gossamer-threads.com//lists/lucene/java-user/38967#38967">"fairly"</a>.</p></li>
-    </ol>
-    In general, Chris Hostetter sums it up best in saying (from <a
-        href="http://www.gossamer-threads.com/lists/lucene/java-user/39125#39125">the Lucene users's mailing list</a>):
-    <blockquote>[One would override the Similarity in] ... any situation where you know more about your data then just
-        that
-        it's "text" is a situation where it *might* make sense to to override your
-        Similarity method.</blockquote>
-</p>
-<a name = "scoring"></a>
-<h2>Changing Scoring &mdash; Expert Level</h2>
-
-<p>Changing scoring is an expert level task, so tread carefully and be prepared to share your code if
-    you want help.
-</p>
-
-<p>With the warning out of the way, it is possible to change a lot more than just the Similarity
-    when it comes to scoring in Lucene. Lucene's scoring is a complex mechanism that is grounded by
-    <span >three main classes</span>:
-    <ol>
-        <li>
-            <a href = "Query.html">Query</a> &mdash; The abstract object representation of the
-            user's information need.</li>
-        <li>
-            <a href = "Weight.html">Weight</a> &mdash; The internal interface representation of
-            the user's Query, so that Query objects may be reused.</li>
-        <li>
-            <a href = "Scorer.html">Scorer</a> &mdash; An abstract class containing common
-            functionality for scoring. Provides both scoring and explanation capabilities.</li>
-    </ol>
-    Details on each of these classes, and their children, can be found in the subsections below.
-</p>
-<h4>The Query Class</h4>
-    <p>In some sense, the
-        <a href = "Query.html">Query</a>
-        class is where it all begins. Without a Query, there would be
-        nothing to score. Furthermore, the Query class is the catalyst for the other scoring classes as it
-        is often responsible
-        for creating them or coordinating the functionality between them. The
-        <a href = "Query.html">Query</a> class has several methods that are important for
-        derived classes:
-        <ol>
-            <li>createWeight(Searcher searcher) &mdash; A
-                <a href = "Weight.html">Weight</a> is the internal representation of the
-                Query, so each Query implementation must
-                provide an implementation of Weight. See the subsection on <a
-                    href="#The Weight Interface">The Weight Interface</a> below for details on implementing the Weight
-                interface.</li>
-            <li>rewrite(IndexReader reader) &mdash; Rewrites queries into primitive queries. Primitive queries are:
-                <a href = "TermQuery.html">TermQuery</a>,
-                <a href = "BooleanQuery.html">BooleanQuery</a>, <span
-                    >and other queries that implement Query.html#createWeight(Searcher searcher)</span></li>
-        </ol>
-    </p>
-<h4>The Weight Interface</h4>
-    <p>The
-        <a href = "Weight.html">Weight</a>
-        interface provides an internal representation of the Query so that it can be reused. Any
-        <a href = "Searcher.html">Searcher</a>
-        dependent state should be stored in the Weight implementation,
-        not in the Query class. The interface defines six methods that must be implemented:
-        <ol>
-            <li>
-                <a href = "Weight.html#getQuery()">Weight#getQuery()</a> &mdash; Pointer to the
-                Query that this Weight represents.</li>
-            <li>
-                <a href = "Weight.html#getValue()">Weight#getValue()</a> &mdash; The weight for
-                this Query. For example, the TermQuery.TermWeight value is
-                equal to the idf^2 * boost * queryNorm <!-- DOUBLE CHECK THIS --></li>
-            <li>
-                <a href = "Weight.html#sumOfSquaredWeights()">
-                    Weight#sumOfSquaredWeights()</a> &mdash; The sum of squared weights. For TermQuery, this is (idf *
-                boost)^2</li>
-            <li>
-                <a href = "Weight.html#normalize(float)">
-                    Weight#normalize(float)</a> &mdash; Determine the query normalization factor. The query normalization may
-                allow for comparing scores between queries.</li>
-            <li>
-                <a href = "Weight.html#scorer(Lucene.Net.Index.IndexReader, boolean, boolean)">
-                    Weight#scorer(IndexReader, boolean, boolean)</a> &mdash; Construct a new
-                <a href = "Scorer.html">Scorer</a>
-                for this Weight. See
-                <a href = "#The Scorer Class">The Scorer Class</a>
-                below for help defining a Scorer. As the name implies, the
-                Scorer is responsible for doing the actual scoring of documents given the Query.
-            </li>
-            <li>
-                <a href = "Weight.html#explain(Lucene.Net.Search.Searcher, Lucene.Net.Index.IndexReader, int)">
-                    Weight#explain(Searcher, IndexReader, int)</a> &mdash; Provide a means for explaining why a given document was
-                scored
-                the way it was.</li>
-        </ol>
-    </p>
-<h4>The Scorer Class</h4>
-    <p>The
-        <a href = "Scorer.html">Scorer</a>
-        abstract class provides common scoring functionality for all Scorer implementations and
-        is the heart of the Lucene scoring process. The Scorer defines the following abstract (they are not
-        yet abstract, but will be in Lucene 3.0 and should be considered as such now) methods which
-        must be implemented (some of them inherited from <a href = "DocIdSetIterator.html">DocIdSetIterator</a> ):
-        <ol>
-            <li>
-                <a href = "DocIdSetIterator.html#nextDoc()">DocIdSetIterator#nextDoc()</a> &mdash; Advances to the next
-                document that matches this Query, returning true if and only
-                if there is another document that matches.</li>
-            <li>
-                <a href = "DocIdSetIterator.html#docID()">DocIdSetIterator#docID()</a> &mdash; Returns the id of the
-                <a href = "document/Document.html">Document</a>
-                that contains the match. It is not valid until next() has been called at least once.
-            </li>
-            <li>
-                <a href = "Scorer.html#score(Lucene.Net.Search.Collector)">Scorer#score(Collector)</a> &mdash;
-                Scores and collects all matching documents using the given Collector.
-            </li>
-            <li>
-                <a href = "Scorer.html#score()">Scorer#score()</a> &mdash; Return the score of the
-                current document. This value can be determined in any
-                appropriate way for an application. For instance, the
-                <a href = "http://svn.apache.org//viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/TermScorer.java?view=log">TermScorer</a>
-                returns the tf * Weight.getValue() * fieldNorm.
-            </li>
-            <li>
-                <a href = "DocIdSetIterator.html#advance(int)">DocIdSetIterator#advance(int)</a> &mdash; Skip ahead in
-                the document matches to the document whose id is greater than
-                or equal to the passed in value. In many instances, advance can be
-                implemented more efficiently than simply looping through all the matching documents until
-                the target document is identified.</li>
-        </ol>
-    </p>
-<h4>Why would I want to add my own Query?</h4>
-
-    <p>In a nutshell, you want to add your own custom Query implementation when you think that Lucene's
-        aren't appropriate for the
-        task that you want to do. You might be doing some cutting edge research or you need more information
-        back
-        out of Lucene (similar to Doug adding SpanQuery functionality).</p>
-
-</body>
-</html>
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+-->
+<html>
+<head>
+   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+<body>
+Code to search indices.
+
+<h2>Table Of Contents</h2>
+<p>
+    <ol>
+        <li><a href="#search">Search Basics</a></li>
+        <li><a href="#query">The Query Classes</a></li>
+        <li><a href="#scoring">Changing the Scoring</a></li>
+    </ol>
+</p>
+<a name="search"></a>
+<h2>Search</h2>
+<p>
+Search over indices.
+
+Applications usually call {@link
+org.apache.lucene.search.Searcher#search(Query,int)} or {@link
+org.apache.lucene.search.Searcher#search(Query,Filter,int)}.
+
+    <!-- FILL IN MORE HERE -->   
+</p>
+<a name="query"></a>
+<h2>Query Classes</h2>
+<h4>
+    <a href="TermQuery.html">TermQuery</a>
+</h4>
+
+<p>Of the various implementations of
+    <a href="Query.html">Query</a>, the
+    <a href="TermQuery.html">TermQuery</a>
+    is the easiest to understand and the most often used in applications. A <a
+        href="TermQuery.html">TermQuery</a> matches all the documents that contain the
+    specified
+    <a href="../index/Term.html">Term</a>,
+    which is a word that occurs in a certain
+    <a href="../document/Field.html">Field</a>.
+    Thus, a <a href="TermQuery.html">TermQuery</a> identifies and scores all
+    <a href="../document/Document.html">Document</a>s that have a <a
+        href="../document/Field.html">Field</a> with the specified string in it.
+    Constructing a <a
+        href="TermQuery.html">TermQuery</a>
+    is as simple as:
+    <pre>
+        TermQuery tq = new TermQuery(new Term("fieldName", "term"));
+    </pre>In this example, the <a href="Query.html">Query</a> identifies all <a
+        href="../document/Document.html">Document</a>s that have the <a
+        href="../document/Field.html">Field</a> named <tt>"fieldName"</tt>
+    containing the word <tt>"term"</tt>.
+</p>
+<h4>
+    <a href="BooleanQuery.html">BooleanQuery</a>
+</h4>
+
+<p>Things start to get interesting when one combines multiple
+    <a href="TermQuery.html">TermQuery</a> instances into a <a
+        href="BooleanQuery.html">BooleanQuery</a>.
+    A <a href="BooleanQuery.html">BooleanQuery</a> contains multiple
+    <a href="BooleanClause.html">BooleanClause</a>s,
+    where each clause contains a sub-query (<a href="Query.html">Query</a>
+    instance) and an operator (from <a
+        href="BooleanClause.Occur.html">BooleanClause.Occur</a>)
+    describing how that sub-query is combined with the other clauses:
+    <ol>
+
+        <li><p>SHOULD &mdash; Use this operator when a clause can occur in the result set, but is not required.
+            If a query is made up of all SHOULD clauses, then every document in the result
+            set matches at least one of these clauses.</p></li>
+
+        <li><p>MUST &mdash; Use this operator when a clause is required to occur in the result set. Every
+            document in the result set will match
+            all such clauses.</p></li>
+
+        <li><p>MUST NOT &mdash; Use this operator when a
+            clause must not occur in the result set. No
+            document in the result set will match
+            any such clauses.</p></li>
+    </ol>
+    Boolean queries are constructed by adding two or more
+    <a href="BooleanClause.html">BooleanClause</a>
+    instances. If too many clauses are added, a <a href="BooleanQuery.TooManyClauses.html">TooManyClauses</a>
+    exception will be thrown during searching. This most often occurs
+    when a <a href="Query.html">Query</a>
+    is rewritten into a <a href="BooleanQuery.html">BooleanQuery</a> with many
+    <a href="TermQuery.html">TermQuery</a> clauses,
+    for example by <a href="WildcardQuery.html">WildcardQuery</a>.
+    The default setting for the maximum number
+    of clauses 1024, but this can be changed via the
+    static method <a href="BooleanQuery.html#setMaxClauseCount(int)">setMaxClauseCount</a>
+    in <a href="BooleanQuery.html">BooleanQuery</a>.
+</p>
+
+<h4>Phrases</h4>
+
+<p>Another common search is to find documents containing certain phrases. This
+    is handled two different ways:
+    <ol>
+        <li>
+            <p><a href="PhraseQuery.html">PhraseQuery</a>
+                &mdash; Matches a sequence of
+                <a href="../index/Term.html">Terms</a>.
+                <a href="PhraseQuery.html">PhraseQuery</a> uses a slop factor to determine
+                how many positions may occur between any two terms in the phrase and still be considered a match.</p>
+        </li>
+        <li>
+            <p><a href="spans/SpanNearQuery.html">SpanNearQuery</a>
+                &mdash; Matches a sequence of other
+                <a href="spans/SpanQuery.html">SpanQuery</a>
+                instances. <a href="spans/SpanNearQuery.html">SpanNearQuery</a> allows for
+                much more
+                complicated phrase queries since it is constructed from other <a
+                    href="spans/SpanQuery.html">SpanQuery</a>
+                instances, instead of only <a href="TermQuery.html">TermQuery</a>
+                instances.</p>
+        </li>
+    </ol>
+</p>
+
+<h4>
+    <a href="TermRangeQuery.html">TermRangeQuery</a>
+</h4>
+
+<p>The
+    <a href="TermRangeQuery.html">TermRangeQuery</a>
+    matches all documents that occur in the
+    exclusive range of a lower
+    <a href="../index/Term.html">Term</a>
+    and an upper
+    <a href="../index/Term.html">Term</a>.
+    according to {@link java.lang.String#compareTo(String)}. It is not intended
+    for numerical ranges, use <a href="NumericRangeQuery.html">NumericRangeQuery</a> instead.
+
+    For example, one could find all documents
+    that have terms beginning with the letters <tt>a</tt> through <tt>c</tt>. This type of <a
+        href="Query.html">Query</a> is frequently used to
+    find
+    documents that occur in a specific date range.
+</p>
+
+<h4>
+    <a href="NumericRangeQuery.html">NumericRangeQuery</a>
+</h4>
+
+<p>The
+    <a href="NumericRangeQuery.html">NumericRangeQuery</a>
+    matches all documents that occur in a numeric range.
+    For NumericRangeQuery to work, you must index the values
+    using a special <a href="../document/NumericField.html">
+    NumericField</a>.
+</p>
+
+<h4>
+    <a href="PrefixQuery.html">PrefixQuery</a>,
+    <a href="WildcardQuery.html">WildcardQuery</a>
+</h4>
+
+<p>While the
+    <a href="PrefixQuery.html">PrefixQuery</a>
+    has a different implementation, it is essentially a special case of the
+    <a href="WildcardQuery.html">WildcardQuery</a>.
+    The <a href="PrefixQuery.html">PrefixQuery</a> allows an application
+    to identify all documents with terms that begin with a certain string. The <a
+        href="WildcardQuery.html">WildcardQuery</a> generalizes this by allowing
+    for the use of <tt>*</tt> (matches 0 or more characters) and <tt>?</tt> (matches exactly one character) wildcards.
+    Note that the <a href="WildcardQuery.html">WildcardQuery</a> can be quite slow. Also
+    note that
+    <a href="WildcardQuery.html">WildcardQuery</a> should
+    not start with <tt>*</tt> and <tt>?</tt>, as these are extremely slow. 
+	To remove this protection and allow a wildcard at the beginning of a term, see method
+	<a href="../queryParser/QueryParser.html#setAllowLeadingWildcard(boolean)">setAllowLeadingWildcard</a> in 
+	<a href="../queryParser/QueryParser.html">QueryParser</a>.
+</p>
+<h4>
+    <a href="FuzzyQuery.html">FuzzyQuery</a>
+</h4>
+
+<p>A
+    <a href="FuzzyQuery.html">FuzzyQuery</a>
+    matches documents that contain terms similar to the specified term. Similarity is
+    determined using
+    <a href="http://en.wikipedia.org/wiki/Levenshtein">Levenshtein (edit) distance</a>.
+    This type of query can be useful when accounting for spelling variations in the collection.
+</p>
+<a name="changingSimilarity"></a>
+<h2>Changing Similarity</h2>
+
+<p>Chances are <a href="DefaultSimilarity.html">DefaultSimilarity</a> is sufficient for all
+    your searching needs.
+    However, in some applications it may be necessary to customize your <a
+        href="Similarity.html">Similarity</a> implementation. For instance, some
+    applications do not need to
+    distinguish between shorter and longer documents (see <a
+        href="http://www.gossamer-threads.com/lists/lucene/java-user/38967#38967">a "fair" similarity</a>).</p>
+
+<p>To change <a href="Similarity.html">Similarity</a>, one must do so for both indexing and
+    searching, and the changes must happen before
+    either of these actions take place. Although in theory there is nothing stopping you from changing mid-stream, it
+    just isn't well-defined what is going to happen.
+</p>
+
+<p>To make this change, implement your own <a href="Similarity.html">Similarity</a> (likely
+    you'll want to simply subclass
+    <a href="DefaultSimilarity.html">DefaultSimilarity</a>) and then use the new
+    class by calling
+    <a href="../index/IndexWriter.html#setSimilarity(org.apache.lucene.search.Similarity)">IndexWriter.setSimilarity</a>
+    before indexing and
+    <a href="Searcher.html#setSimilarity(org.apache.lucene.search.Similarity)">Searcher.setSimilarity</a>
+    before searching.
+</p>
+
+<p>
+    If you are interested in use cases for changing your similarity, see the Lucene users's mailing list at <a
+        href="http://www.nabble.com/Overriding-Similarity-tf2128934.html">Overriding Similarity</a>.
+    In summary, here are a few use cases:
+    <ol>
+        <li><p><a href="api/org/apache/lucene/misc/SweetSpotSimilarity.html">SweetSpotSimilarity</a> &mdash; <a
+                href="api/org/apache/lucene/misc/SweetSpotSimilarity.html">SweetSpotSimilarity</a> gives small increases
+            as the frequency increases a small amount
+            and then greater increases when you hit the "sweet spot", i.e. where you think the frequency of terms is
+            more significant.</p></li>
+        <li><p>Overriding tf &mdash; In some applications, it doesn't matter what the score of a document is as long as a
+            matching term occurs. In these
+            cases people have overridden Similarity to return 1 from the tf() method.</p></li>
+        <li><p>Changing Length Normalization &mdash; By overriding <a
+                href="Similarity.html#lengthNorm(java.lang.String,%20int)">lengthNorm</a>,
+            it is possible to discount how the length of a field contributes
+            to a score. In <a href="DefaultSimilarity.html">DefaultSimilarity</a>,
+            lengthNorm = 1 / (numTerms in field)^0.5, but if one changes this to be
+            1 / (numTerms in field), all fields will be treated
+            <a href="http://www.gossamer-threads.com/lists/lucene/java-user/38967#38967">"fairly"</a>.</p></li>
+    </ol>
+    In general, Chris Hostetter sums it up best in saying (from <a
+        href="http://www.gossamer-threads.com/lists/lucene/java-user/39125#39125">the Lucene users's mailing list</a>):
+    <blockquote>[One would override the Similarity in] ... any situation where you know more about your data then just
+        that
+        it's "text" is a situation where it *might* make sense to to override your
+        Similarity method.</blockquote>
+</p>
+<a name="scoring"></a>
+<h2>Changing Scoring &mdash; Expert Level</h2>
+
+<p>Changing scoring is an expert level task, so tread carefully and be prepared to share your code if
+    you want help.
+</p>
+
+<p>With the warning out of the way, it is possible to change a lot more than just the Similarity
+    when it comes to scoring in Lucene. Lucene's scoring is a complex mechanism that is grounded by
+    <span >three main classes</span>:
+    <ol>
+        <li>
+            <a href="Query.html">Query</a> &mdash; The abstract object representation of the
+            user's information need.</li>
+        <li>
+            <a href="Weight.html">Weight</a> &mdash; The internal interface representation of
+            the user's Query, so that Query objects may be reused.</li>
+        <li>
+            <a href="Scorer.html">Scorer</a> &mdash; An abstract class containing common
+            functionality for scoring. Provides both scoring and explanation capabilities.</li>
+    </ol>
+    Details on each of these classes, and their children, can be found in the subsections below.
+</p>
+<h4>The Query Class</h4>
+    <p>In some sense, the
+        <a href="Query.html">Query</a>
+        class is where it all begins. Without a Query, there would be
+        nothing to score. Furthermore, the Query class is the catalyst for the other scoring classes as it
+        is often responsible
+        for creating them or coordinating the functionality between them. The
+        <a href="Query.html">Query</a> class has several methods that are important for
+        derived classes:
+        <ol>
+            <li>createWeight(Searcher searcher) &mdash; A
+                <a href="Weight.html">Weight</a> is the internal representation of the
+                Query, so each Query implementation must
+                provide an implementation of Weight. See the subsection on <a
+                    href="#The Weight Interface">The Weight Interface</a> below for details on implementing the Weight
+                interface.</li>
+            <li>rewrite(IndexReader reader) &mdash; Rewrites queries into primitive queries. Primitive queries are:
+                <a href="TermQuery.html">TermQuery</a>,
+                <a href="BooleanQuery.html">BooleanQuery</a>, <span
+                    >and other queries that implement Query.html#createWeight(Searcher searcher)</span></li>
+        </ol>
+    </p>
+<h4>The Weight Interface</h4>
+    <p>The
+        <a href="Weight.html">Weight</a>
+        interface provides an internal representation of the Query so that it can be reused. Any
+        <a href="Searcher.html">Searcher</a>
+        dependent state should be stored in the Weight implementation,
+        not in the Query class. The interface defines six methods that must be implemented:
+        <ol>
+            <li>
+                <a href="Weight.html#getQuery()">Weight#getQuery()</a> &mdash; Pointer to the
+                Query that this Weight represents.</li>
+            <li>
+                <a href="Weight.html#getValue()">Weight#getValue()</a> &mdash; The weight for
+                this Query. For example, the TermQuery.TermWeight value is
+                equal to the idf^2 * boost * queryNorm <!-- DOUBLE CHECK THIS --></li>
+            <li>
+                <a href="Weight.html#sumOfSquaredWeights()">
+                    Weight#sumOfSquaredWeights()</a> &mdash; The sum of squared weights. For TermQuery, this is (idf *
+                boost)^2</li>
+            <li>
+                <a href="Weight.html#normalize(float)">
+                    Weight#normalize(float)</a> &mdash; Determine the query normalization factor. The query normalization may
+                allow for comparing scores between queries.</li>
+            <li>
+                <a href="Weight.html#scorer(org.apache.lucene.index.IndexReader, boolean, boolean)">
+                    Weight#scorer(IndexReader, boolean, boolean)</a> &mdash; Construct a new
+                <a href="Scorer.html">Scorer</a>
+                for this Weight. See
+                <a href="#The Scorer Class">The Scorer Class</a>
+                below for help defining a Scorer. As the name implies, the
+                Scorer is responsible for doing the actual scoring of documents given the Query.
+            </li>
+            <li>
+                <a href="Weight.html#explain(org.apache.lucene.search.Searcher, org.apache.lucene.index.IndexReader, int)">
+                    Weight#explain(Searcher, IndexReader, int)</a> &mdash; Provide a means for explaining why a given document was
+                scored
+                the way it was.</li>
+        </ol>
+    </p>
+<h4>The Scorer Class</h4>
+    <p>The
+        <a href="Scorer.html">Scorer</a>
+        abstract class provides common scoring functionality for all Scorer implementations and
+        is the heart of the Lucene scoring process. The Scorer defines the following abstract (they are not
+        yet abstract, but will be in Lucene 3.0 and should be considered as such now) methods which
+        must be implemented (some of them inherited from <a href="DocIdSetIterator.html">DocIdSetIterator</a> ):
+        <ol>
+            <li>
+                <a href="DocIdSetIterator.html#nextDoc()">DocIdSetIterator#nextDoc()</a> &mdash; Advances to the next
+                document that matches this Query, returning true if and only
+                if there is another document that matches.</li>
+            <li>
+                <a href="DocIdSetIterator.html#docID()">DocIdSetIterator#docID()</a> &mdash; Returns the id of the
+                <a href="../document/Document.html">Document</a>
+                that contains the match. It is not valid until next() has been called at least once.
+            </li>
+            <li>
+                <a href="Scorer.html#score(org.apache.lucene.search.Collector)">Scorer#score(Collector)</a> &mdash;
+                Scores and collects all matching documents using the given Collector.
+            </li>
+            <li>
+                <a href="Scorer.html#score()">Scorer#score()</a> &mdash; Return the score of the
+                current document. This value can be determined in any
+                appropriate way for an application. For instance, the
+                <a href="http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/TermScorer.java?view=log">TermScorer</a>
+                returns the tf * Weight.getValue() * fieldNorm.
+            </li>
+            <li>
+                <a href="DocIdSetIterator.html#advance(int)">DocIdSetIterator#advance(int)</a> &mdash; Skip ahead in
+                the document matches to the document whose id is greater than
+                or equal to the passed in value. In many instances, advance can be
+                implemented more efficiently than simply looping through all the matching documents until
+                the target document is identified.</li>
+        </ol>
+    </p>
+<h4>Why would I want to add my own Query?</h4>
+
+    <p>In a nutshell, you want to add your own custom Query implementation when you think that Lucene's
+        aren't appropriate for the
+        task that you want to do. You might be doing some cutting edge research or you need more information
+        back
+        out of Lucene (similar to Doug adding SpanQuery functionality).</p>
+
+</body>
+</html>

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Payloads/PayloadNearQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Payloads/PayloadNearQuery.cs?rev=1203896&r1=1203895&r2=1203896&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Payloads/PayloadNearQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Payloads/PayloadNearQuery.cs Fri Nov 18 23:05:13 2011
@@ -265,7 +265,7 @@ namespace Lucene.Net.Search.Payloads
 				return base.Score() * Enclosing_Instance.function.DocScore(doc, Enclosing_Instance.fieldName, payloadsSeen, payloadScore);
 			}
 			
-			public override Explanation Explain(int doc)
+			protected internal override Explanation Explain(int doc)
 			{
 				Explanation result = new Explanation();
 				Explanation nonPayloadExpl = base.Explain(doc);

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Payloads/PayloadTermQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Payloads/PayloadTermQuery.cs?rev=1203896&r1=1203895&r2=1203896&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Payloads/PayloadTermQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Payloads/PayloadTermQuery.cs Fri Nov 18 23:05:13 2011
@@ -197,7 +197,7 @@ namespace Lucene.Net.Search.Payloads
 					return Enclosing_Instance.Enclosing_Instance.function.DocScore(doc, Enclosing_Instance.Enclosing_Instance.term.Field(), payloadsSeen, payloadScore);
 				}
 				
-				public override Explanation Explain(int doc)
+				protected internal override Explanation Explain(int doc)
 				{
 					ComplexExplanation result = new ComplexExplanation();
 					Explanation nonPayloadExpl = base.Explain(doc);

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/PhraseScorer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/PhraseScorer.cs?rev=1203896&r1=1203895&r2=1203896&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/PhraseScorer.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/PhraseScorer.cs Fri Nov 18 23:05:13 2011
@@ -149,10 +149,11 @@ namespace Lucene.Net.Search
 			}
 			return first.doc;
 		}
-		
+
         /// <summary>
-        /// phrase frequency in current doc as computed by phraseFreq().
+        /// Phrase frequency in current doc as computed by PhraseFreq()
         /// </summary>
+        /// <returns></returns>
         public float CurrentFreq()
         {
             return freq;
@@ -215,18 +216,6 @@ namespace Lucene.Net.Search
 			last.next = null;
 		}
 		
-		public override Explanation Explain(int doc)
-		{
-			Explanation tfExplanation = new Explanation();
-			
-			int d = Advance(doc);
-			float phraseFreq = (d == doc)?freq:0.0f;
-			tfExplanation.SetValue(GetSimilarity().Tf(phraseFreq));
-			tfExplanation.SetDescription("tf(phraseFreq=" + phraseFreq + ")");
-			
-			return tfExplanation;
-		}
-		
 		public override System.String ToString()
 		{
 			return "scorer(" + weight + ")";

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/QueryTermVector.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/QueryTermVector.cs?rev=1203896&r1=1203895&r2=1203896&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/QueryTermVector.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/QueryTermVector.cs Fri Nov 18 23:05:13 2011
@@ -16,7 +16,9 @@
  */
 
 using System;
-
+using System.Collections.Generic;
+using System.Linq;
+using Lucene.Net.Support;
 using Analyzer = Lucene.Net.Analysis.Analyzer;
 using TokenStream = Lucene.Net.Analysis.TokenStream;
 using TermAttribute = Lucene.Net.Analysis.Tokenattributes.TermAttribute;
@@ -55,7 +57,7 @@ namespace Lucene.Net.Search
 				TokenStream stream = analyzer.TokenStream("", new System.IO.StringReader(queryString));
 				if (stream != null)
 				{
-					System.Collections.ArrayList terms = new System.Collections.ArrayList();
+					IList<string> terms = new List<string>();
 					try
 					{
 						bool hasMoreTokens = false;
@@ -69,7 +71,7 @@ namespace Lucene.Net.Search
 							terms.Add(termAtt.Term());
 							hasMoreTokens = stream.IncrementToken();
 						}
-						ProcessTerms((System.String[]) terms.ToArray(typeof(System.String)));
+						ProcessTerms(terms.ToArray());
 					}
 					catch (System.IO.IOException e)
 					{
@@ -83,35 +85,33 @@ namespace Lucene.Net.Search
 			if (queryTerms != null)
 			{
 				System.Array.Sort(queryTerms);
-				System.Collections.IDictionary tmpSet = new System.Collections.Hashtable(queryTerms.Length);
+				IDictionary<string, int> tmpSet = new HashMap<string, int>(queryTerms.Length);
 				//filter out duplicates
-				System.Collections.ArrayList tmpList = new System.Collections.ArrayList(queryTerms.Length);
-				System.Collections.ArrayList tmpFreqs = new System.Collections.ArrayList(queryTerms.Length);
+				IList<string> tmpList = new List<string>(queryTerms.Length);
+				IList<int> tmpFreqs = new List<int>(queryTerms.Length);
 				int j = 0;
 				for (int i = 0; i < queryTerms.Length; i++)
 				{
-					System.String term = queryTerms[i];
-					System.Object temp_position = tmpSet[term];
-					if (temp_position == null)
+					var term = queryTerms[i];
+					var position = tmpSet[term];
+					if (!tmpSet.ContainsKey(term)) // if temp_position == null
 					{
-						tmpSet[term] = (System.Int32) j++;
+						tmpSet[term] = j++;
 						tmpList.Add(term);
 						tmpFreqs.Add(1);
 					}
 					else
 					{
-                        System.Int32 position = (System.Int32) tmpSet[term];
-						System.Int32 integer = (System.Int32) tmpFreqs[position];
-						tmpFreqs[position] = (System.Int32) (integer + 1);
+						int integer = tmpFreqs[position];
+						tmpFreqs[position] = (integer + 1);
 					}
 				}
-                terms = (System.String[]) tmpList.ToArray(typeof(System.String));
+                terms = tmpList.ToArray();
 				//termFreqs = (int[])tmpFreqs.toArray(termFreqs);
 				termFreqs = new int[tmpFreqs.Count];
 				int i2 = 0;
-				for (System.Collections.IEnumerator iter = tmpFreqs.GetEnumerator(); iter.MoveNext(); )
+                foreach (int integer in tmpFreqs)
 				{
-					System.Int32 integer = (System.Int32) iter.Current;
 					termFreqs[i2++] = integer;
 				}
 			}

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Scorer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Scorer.cs?rev=1203896&r1=1203895&r2=1203896&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Scorer.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Scorer.cs Fri Nov 18 23:05:13 2011
@@ -37,10 +37,7 @@ namespace Lucene.Net.Search
 	/// not valid scores.  Certain collectors (eg <see cref="TopScoreDocCollector" />
 	///) will not properly collect hits
 	/// with these scores.
-	/// 
 	/// </summary>
-	/// <seealso cref="BooleanQuery.SetAllowDocsOutOfOrder">
-	/// </seealso>
 	public abstract class Scorer:DocIdSetIterator
 	{
 		private Similarity similarity;
@@ -60,21 +57,7 @@ namespace Lucene.Net.Search
 		}
 		
 		/// <summary>Scores and collects all matching documents.</summary>
-		/// <param name="hc">The collector to which all matching documents are passed through
-		/// <see cref="HitCollector.Collect(int, float)" />.
-		/// <br/>When this method is used the <see cref="Explain(int)" /> method should not be used.
-		/// </param>
-		/// <deprecated> use <see cref="Score(Collector)" /> instead.
-		/// </deprecated>
-        [Obsolete("use Score(Collector) instead.")]
-		public virtual void  Score(HitCollector hc)
-		{
-			Score(new HitCollectorWrapper(hc));
-		}
-		
-		/// <summary>Scores and collects all matching documents.</summary>
 		/// <param name="collector">The collector to which all matching documents are passed.
-		/// <br/>When this method is used the <see cref="Explain(int)" /> method should not be used.
 		/// </param>
 		public virtual void  Score(Collector collector)
 		{
@@ -86,25 +69,6 @@ namespace Lucene.Net.Search
 			}
 		}
 		
-		/// <summary>Expert: Collects matching documents in a range.  Hook for optimization.
-		/// Note that <see cref="DocIdSetIterator.Next()" /> must be called once before this method is called
-		/// for the first time.
-		/// </summary>
-		/// <param name="hc">The collector to which all matching documents are passed through
-		/// <see cref="HitCollector.Collect(int, float)" />.
-		/// </param>
-		/// <param name="max">Do not score documents past this.
-		/// </param>
-		/// <returns> true if more matching documents may remain.
-		/// </returns>
-		/// <deprecated> use <see cref="Score(Collector, int, int)" /> instead.
-		/// </deprecated>
-        [Obsolete("use Score(Collector, int, int) instead")]
-		protected internal virtual bool Score(HitCollector hc, int max)
-		{
-			return Score(new HitCollectorWrapper(hc), max, DocID());
-		}
-		
 		/// <summary> Expert: Collects matching documents in a range. Hook for optimization.
 		/// Note, <paramref name="firstDocID" /> is added to ensure that <see cref="DocIdSetIterator.NextDoc()" />
 		/// was called before this method.
@@ -133,25 +97,10 @@ namespace Lucene.Net.Search
 		}
 		
 		/// <summary>Returns the score of the current document matching the query.
-        /// Initially invalid, until <see cref="DocIdSetIterator.Next()" /> or <see cref="DocIdSetIterator.SkipTo(int)" />
+        /// Initially invalid, until <see cref="DocIdSetIterator.NextDoc()" /> or <see cref="DocIdSetIterator.Advance(int)" />
 		/// is called the first time, or when called from within
 		/// <see cref="Collector.Collect(int)" />.
 		/// </summary>
 		public abstract float Score();
-		
-		/// <summary>Returns an explanation of the score for a document.
-        /// <br/>When this method is used, the <see cref="DocIdSetIterator.Next()" />, <see cref="DocIdSetIterator.SkipTo(int)" /> and
-		/// <see cref="Score(HitCollector)" /> methods should not be used.
-		/// </summary>
-		/// <param name="doc">The document number for the explanation.
-		/// 
-		/// </param>
-		/// <deprecated> Please use <see cref="IndexSearcher.Explain(Lucene.Net.Search.Weight,int)" />
-		/// or <see cref="Weight.Explain(IndexReader, int)" /> instead.
-		/// </deprecated>
-		public virtual Explanation Explain(int doc)
-		{
-			throw new System.NotSupportedException();
-		}
 	}
 }
\ No newline at end of file

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/SortField.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/SortField.cs?rev=1203896&r1=1203895&r2=1203896&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/SortField.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/SortField.cs Fri Nov 18 23:05:13 2011
@@ -31,14 +31,8 @@ namespace Lucene.Net.Search
 	/// field.  Fields must be indexed in order to sort by them.
 	/// 
 	/// <p/>Created: Feb 11, 2004 1:25:29 PM
-	/// 
 	/// </summary>
-	/// <since>   lucene 1.4
-	/// </since>
-	/// <version>  $Id: SortField.java 801344 2009-08-05 18:05:06Z yonik $
-	/// </version>
-	/// <seealso cref="Sort">
-	/// </seealso>
+	/// <seealso cref="Sort"></seealso>
 	[Serializable]
 	public class SortField
 	{

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/SpanFilterResult.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/SpanFilterResult.cs?rev=1203896&r1=1203895&r2=1203896&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/SpanFilterResult.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/SpanFilterResult.cs Fri Nov 18 23:05:13 2011
@@ -16,48 +16,26 @@
  */
 
 using System;
+using System.Collections.Generic;
 
 namespace Lucene.Net.Search
 {
-	
-	
 	/// <summary>  The results of a SpanQueryFilter.  Wraps the BitSet and the position information from the SpanQuery
 	/// 
 	/// <p/>
 	/// NOTE: This API is still experimental and subject to change. 
-	/// 
-	/// 
 	/// </summary>
 	public class SpanFilterResult
 	{
-		/// <deprecated> 
-		/// </deprecated>
-        [Obsolete]
-		private System.Collections.BitArray bits;
-		
 		private DocIdSet docIdSet;
-		private System.Collections.IList positions; //Spans spans;
-		
-		/// <summary> </summary>
-		/// <param name="bits">The bits for the Filter
-		/// </param>
-		/// <param name="positions">A List of <see cref="Lucene.Net.Search.SpanFilterResult.PositionInfo" /> objects
-		/// </param>
-        /// <deprecated> Use <see cref="SpanFilterResult(DocIdSet, System.Collections.IList)" /> instead
-		/// </deprecated>
-        [Obsolete("Use SpanFilterResult(DocIdSet, List) instead")]
-		public SpanFilterResult(System.Collections.BitArray bits, System.Collections.IList positions)
-		{
-			this.bits = bits;
-			this.positions = positions;
-		}
+		private IList<PositionInfo> positions; //Spans spans;
 		
 		/// <summary> </summary>
 		/// <param name="docIdSet">The DocIdSet for the Filter
 		/// </param>
 		/// <param name="positions">A List of <see cref="Lucene.Net.Search.SpanFilterResult.PositionInfo" /> objects
 		/// </param>
-		public SpanFilterResult(DocIdSet docIdSet, System.Collections.IList positions)
+		public SpanFilterResult(DocIdSet docIdSet, IList<PositionInfo> positions)
 		{
 			this.docIdSet = docIdSet;
 			this.positions = positions;
@@ -68,19 +46,11 @@ namespace Lucene.Net.Search
 		/// </summary>
 		/// <returns> A List of PositionInfo objects
 		/// </returns>
-		public virtual System.Collections.IList GetPositions()
+        public virtual IList<PositionInfo> GetPositions()
 		{
 			return positions;
 		}
 		
-		/// <deprecated> Use <see cref="GetDocIdSet()" />
-		/// </deprecated>
-        [Obsolete("Use GetDocIdSet()")]
-		public virtual System.Collections.BitArray GetBits()
-		{
-			return bits;
-		}
-		
 		/// <summary>Returns the docIdSet </summary>
 		public virtual DocIdSet GetDocIdSet()
 		{
@@ -90,13 +60,13 @@ namespace Lucene.Net.Search
 		public class PositionInfo
 		{
 			private int doc;
-			private System.Collections.IList positions;
+            private IList<StartEnd> positions;
 			
 			
 			public PositionInfo(int doc)
 			{
 				this.doc = doc;
-				positions = new System.Collections.ArrayList();
+				positions = new List<StartEnd>();
 			}
 			
 			public virtual void  AddPosition(int start, int end)
@@ -112,7 +82,7 @@ namespace Lucene.Net.Search
 			/// <summary> </summary>
 			/// <returns> A List of <see cref="Lucene.Net.Search.SpanFilterResult.StartEnd" /> objects
 			/// </returns>
-			public virtual System.Collections.IList GetPositions()
+            public virtual IList<StartEnd> GetPositions()
 			{
 				return positions;
 			}

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/SpanQueryFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/SpanQueryFilter.cs?rev=1203896&r1=1203895&r2=1203896&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/SpanQueryFilter.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/SpanQueryFilter.cs Fri Nov 18 23:05:13 2011
@@ -16,7 +16,7 @@
  */
 
 using System;
-
+using System.Collections.Generic;
 using IndexReader = Lucene.Net.Index.IndexReader;
 using OpenBitSet = Lucene.Net.Util.OpenBitSet;
 using SpanQuery = Lucene.Net.Search.Spans.SpanQuery;
@@ -67,7 +67,7 @@ namespace Lucene.Net.Search
 			
 			OpenBitSet bits = new OpenBitSet(reader.MaxDoc());
 			Lucene.Net.Search.Spans.Spans spans = query.GetSpans(reader);
-			System.Collections.IList tmp = new System.Collections.ArrayList(20);
+			IList<SpanFilterResult.PositionInfo> tmp = new List<SpanFilterResult.PositionInfo>(20);
 			int currentDoc = - 1;
 			SpanFilterResult.PositionInfo currentInfo = null;
 			while (spans.Next())

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Spans/SpanScorer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Spans/SpanScorer.cs?rev=1203896&r1=1203895&r2=1203896&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Spans/SpanScorer.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Spans/SpanScorer.cs Fri Nov 18 23:05:13 2011
@@ -24,7 +24,6 @@ using Weight = Lucene.Net.Search.Weight;
 
 namespace Lucene.Net.Search.Spans
 {
-	
 	/// <summary> Public for extension only.</summary>
 	public class SpanScorer:Scorer
 	{
@@ -115,7 +114,7 @@ namespace Lucene.Net.Search.Spans
         /// This method is no longer an official member of <see cref="Scorer"/>
         /// but it is needed by SpanWeight to build an explanation.
         /// </summary>
-		public override Explanation Explain(int doc)
+		protected internal virtual Explanation Explain(int doc)
 		{
 			Explanation tfExplanation = new Explanation();
 			

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Spans/SpanWeight.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Spans/SpanWeight.cs?rev=1203896&r1=1203895&r2=1203896&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Spans/SpanWeight.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Spans/SpanWeight.cs Fri Nov 18 23:05:13 2011
@@ -107,7 +107,7 @@ namespace Lucene.Net.Search.Spans
 			ComplexExplanation fieldExpl = new ComplexExplanation();
 			fieldExpl.SetDescription("fieldWeight(" + field + ":" + query.ToString(field) + " in " + doc + "), product of:");
 			
-			Explanation tfExpl = Scorer(reader, true, false).Explain(doc);
+			Explanation tfExpl = ((SpanScorer)Scorer(reader, true, false)).Explain(doc);
 			fieldExpl.AddDetail(tfExpl);
 			fieldExpl.AddDetail(idfExpl);
 			

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/TimeLimitingCollector.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/TimeLimitingCollector.cs?rev=1203896&r1=1203895&r2=1203896&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/TimeLimitingCollector.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/TimeLimitingCollector.cs Fri Nov 18 23:05:13 2011
@@ -85,8 +85,7 @@ namespace Lucene.Net.Search
 					}
 					catch (System.Threading.ThreadInterruptedException ie)
 					{
-						ThreadClass.Current().Interrupt();
-						throw new System.SystemException(ie.Message, ie);
+					    throw;
 					}
 				}
 			}

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/WildcardTermEnum.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/WildcardTermEnum.cs?rev=1203896&r1=1203895&r2=1203896&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/WildcardTermEnum.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/WildcardTermEnum.cs Fri Nov 18 23:05:13 2011
@@ -28,10 +28,7 @@ namespace Lucene.Net.Search
 	/// <p/>
 	/// Term enumerations are always ordered by Term.compareTo().  Each term in
 	/// the enumeration is greater than all that precede it.
-	/// 
 	/// </summary>
-	/// <version>  $Id: WildcardTermEnum.java 783371 2009-06-10 14:39:56Z mikemccand $
-	/// </version>
 	public class WildcardTermEnum : FilteredTermEnum
 	{
 		internal Term searchTerm;

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Support/HashMap.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Support/HashMap.cs?rev=1203896&r1=1203895&r2=1203896&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Support/HashMap.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Support/HashMap.cs Fri Nov 18 23:05:13 2011
@@ -34,7 +34,7 @@ namespace Lucene.Net.Support
     [Serializable]
     public class HashMap<TKey, TValue> : IDictionary<TKey, TValue>
     {
-        internal EqualityComparer<TKey> _comparer;
+        internal IEqualityComparer<TKey> _comparer;
         internal Dictionary<TKey, TValue> _dict;
 
         // Indicates if a null key has been assigned, used for iteration
@@ -48,10 +48,22 @@ namespace Lucene.Net.Support
             : this(0)
         { }
 
+        public HashMap(IEqualityComparer<TKey> comparer)
+            : this(0, comparer)
+        {
+            
+        }
+
         public HashMap(int initialCapacity)
+            : this(initialCapacity, EqualityComparer<TKey>.Default)
+        {
+            
+        }
+
+        public HashMap(int initialCapacity, IEqualityComparer<TKey> comparer)
         {
-            _dict = new Dictionary<TKey, TValue>(initialCapacity);
-            _comparer = EqualityComparer<TKey>.Default;
+            _comparer = comparer;
+            _dict = new Dictionary<TKey, TValue>(initialCapacity, _comparer);
             _hasNullValue = false;
 
             if (typeof(TKey).IsValueType)

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Support/WeakDictionary.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Support/WeakDictionary.cs?rev=1203896&r1=1203895&r2=1203896&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Support/WeakDictionary.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Support/WeakDictionary.cs Fri Nov 18 23:05:13 2011
@@ -32,10 +32,12 @@ namespace Lucene.Net.Support
         private void Clean()
         {
             if (_hm.Count == 0) return;
-            while (_hm.Keys.Where(x => x != null).Any(x => !x.IsAlive))
+            var newHm = new HashMap<WeakKey<TKey>, TValue>();
+            foreach (var entry in _hm.Where(x => x.Key != null && !x.Key.IsAlive))
             {
-                _hm.Remove(_hm.Keys.Where(x => x != null && !x.IsAlive).First());
+                newHm.Add(entry.Key, entry.Value);
             }
+            _hm = newHm;
         }
 
         private void CleanIfNeeded()
@@ -243,15 +245,18 @@ namespace Lucene.Net.Support
             {
                 if (!reference.IsAlive || obj == null) return false;
 
-                if (GetHashCode() != obj.GetHashCode()) return false;
+                if (ReferenceEquals(this, obj))
+                {
+                    return true;
+                }
 
                 if (obj is WeakKey<T>)
                 {
                     var other = (WeakKey<T>)obj;
-                    return other.IsAlive && ReferenceEquals(reference.Target, other.Target);
+                    return reference.Target.Equals(other.Target);
                 }
 
-                return reference.Target.Equals(obj);
+                return false;
             }
 
             public T Target

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestBooleanScorer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestBooleanScorer.cs?rev=1203896&r1=1203895&r2=1203896&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestBooleanScorer.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestBooleanScorer.cs Fri Nov 18 23:05:13 2011
@@ -52,10 +52,7 @@ namespace Lucene.Net.Search
 				InitBlock(enclosingInstance);
 			}
 			private int doc = - 1;
-			public override Explanation Explain(int doc)
-			{
-				return null;
-			}
+
 			public override float Score()
 			{
 				return 0;

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestSpanQueryFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestSpanQueryFilter.cs?rev=1203896&r1=1203895&r2=1203896&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestSpanQueryFilter.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestSpanQueryFilter.cs Fri Nov 18 23:05:13 2011
@@ -50,7 +50,7 @@ namespace Lucene.Net.Search
 			}
 			writer.Close();
 			
-			IndexReader reader = IndexReader.Open(dir);
+			IndexReader reader = IndexReader.Open(dir, true);
 			
 			SpanTermQuery query = new SpanTermQuery(new Term("field", English.IntToEnglish(10).Trim()));
 			SpanQueryFilter filter = new SpanQueryFilter(query);
@@ -58,7 +58,7 @@ namespace Lucene.Net.Search
 			DocIdSet docIdSet = result.GetDocIdSet();
 			Assert.IsTrue(docIdSet != null, "docIdSet is null and it shouldn't be");
 			AssertContainsDocId("docIdSet doesn't contain docId 10", docIdSet, 10);
-			System.Collections.IList spans = result.GetPositions();
+			var spans = result.GetPositions();
 			Assert.IsTrue(spans != null, "spans is null and it shouldn't be");
 			int size = GetDocIdSetSize(docIdSet);
 			Assert.IsTrue(spans.Count == size, "spans Size: " + spans.Count + " is not: " + size);

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/UpdatedTests.txt
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/UpdatedTests.txt?rev=1203896&r1=1203895&r2=1203896&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/UpdatedTests.txt (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/UpdatedTests.txt Fri Nov 18 23:05:13 2011
@@ -201,7 +201,7 @@ search\TestSimpleExplanations.java - DON
 search\TestSimpleExplanationsOfNonMatches.java - Text files are different
 search\TestSloppyPhraseQuery.java - Text files are different
 search\TestSort.java - DONE
-search\TestSpanQueryFilter.java - Text files are different
+search\TestSpanQueryFilter.java - DONE
 search\TestStressSort.java - REMOVED
 search\TestTermRangeFilter.java - DONE
 search\TestTermRangeQuery.java - DONE