lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aro...@apache.org
Subject svn commit: r411501 [16/30] - 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/Docu...
Date Sun, 04 Jun 2006 02:41:25 GMT
Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/QueryParser.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/QueryParser/QueryParser.cs?rev=411501&r1=411500&r2=411501&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/QueryParser.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/QueryParser.cs Sat Jun  3 19:41:13 2006
@@ -13,18 +13,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 /* Generated By:JavaCC: Do not edit this line. QueryParser.java */
+
 using System;
 using Lucene.Net.Analysis;
 using Lucene.Net.Documents;
 using Term = Lucene.Net.Index.Term;
 using Lucene.Net.Search;
 using Searchable = Lucene.Net.Search.Searchable;
+using Parameter = Lucene.Net.Util.Parameter;
+
 namespace Lucene.Net.QueryParsers
 {
 	
-	/// <summary> This class is generated by JavaCC.  The only method that clients should need
-	/// to call is <a href="#parse">parse()</a>.
+	/// <summary> This class is generated by JavaCC.  The most important method is
+	/// {@link #Parse(String)}.
 	/// 
 	/// The syntax for query strings is as follows:
 	/// A Query is a series of clauses.
@@ -32,7 +36,7 @@
 	/// <ul>
 	/// <li> a plus (<code>+</code>) or a minus (<code>-</code>) sign, indicating
 	/// that the clause is required or prohibited respectively; or
-	/// <li> a term followed by a colon, indicating the Field to be searched.
+	/// <li> a term followed by a colon, indicating the field to be searched.
 	/// This enables one to construct queries which search multiple fields.
 	/// </ul>
 	/// 
@@ -52,9 +56,12 @@
 	/// 
 	/// <p>
 	/// Examples of appropriately formatted queries can be found in the <a
-	/// href="http://jakarta.apache.org/lucene/src/test/org/apache/lucene/queryParser/TestQueryParser.java">test cases</a>.
+	/// href="http://lucene.apache.org/java/docs/queryparsersyntax.html">query syntax
+	/// documentation</a>.
 	/// </p>
 	/// 
+	/// <p>Note that QueryParser is <em>not</em> thread-safe.</p>
+	/// 
 	/// </summary>
 	/// <author>  Brian Goetz
 	/// </author>
@@ -65,12 +72,13 @@
 	
 	public class QueryParser : QueryParserConstants
 	{
-        private void  InitBlock()
-        {
-            fuzzyMinSim = Lucene.Net.Search.FuzzyQuery.defaultMinSimilarity;
-            jj_2_rtns = new JJCalls[1];
-            jj_ls = new LookaheadSuccess();
-        }
+		private void  InitBlock()
+		{
+			fuzzyMinSim = FuzzyQuery.defaultMinSimilarity;
+			fuzzyPrefixLength = FuzzyQuery.defaultPrefixLength;
+			jj_2_rtns = new JJCalls[1];
+			jj_ls = new LookaheadSuccess();
+		}
 		
 		private const int CONJ_NONE = 0;
 		private const int CONJ_AND = 1;
@@ -80,31 +88,57 @@
 		private const int MOD_NOT = 10;
 		private const int MOD_REQ = 11;
 		
+		/// <deprecated> use {@link #OR_OPERATOR} instead 
+		/// </deprecated>
 		public const int DEFAULT_OPERATOR_OR = 0;
+		/// <deprecated> use {@link #AND_OPERATOR} instead 
+		/// </deprecated>
 		public const int DEFAULT_OPERATOR_AND = 1;
 		
+		// make it possible to call setDefaultOperator() without accessing 
+		// the nested class:
+		/// <summary>Alternative form of QueryParser.Operator.AND </summary>
+		public static readonly Operator AND_OPERATOR = Operator.AND;
+		/// <summary>Alternative form of QueryParser.Operator.OR </summary>
+		public static readonly Operator OR_OPERATOR = Operator.OR;
+		
 		/// <summary>The actual operator that parser uses to combine query terms </summary>
-		private int operator_Renamed = DEFAULT_OPERATOR_OR;
+		private Operator operator_Renamed = OR_OPERATOR;
 		
-		/// <summary> Whether terms of wildcard and prefix queries are to be automatically
-		/// lower-cased or not.  Default is <code>true</code>.
-		/// </summary>
-		internal bool lowercaseWildcardTerms = true;
+		internal bool lowercaseExpandedTerms = true;
 		
 		internal Analyzer analyzer;
 		internal System.String field;
 		internal int phraseSlop = 0;
-        internal float fuzzyMinSim;
+		internal float fuzzyMinSim;
+		internal int fuzzyPrefixLength;
 		internal System.Globalization.CultureInfo locale = System.Threading.Thread.CurrentThread.CurrentCulture;
 		
-		/// <summary>Parses a query string, returning a {@link Lucene.Net.Search.Query}.</summary>
+		/// <summary>The default operator for parsing queries. 
+		/// Use {@link QueryParser#setDefaultOperator} to change it.
+		/// </summary>
+		[Serializable]
+		public sealed class Operator : Parameter
+		{
+			internal Operator(System.String name) : base(name)
+			{
+			}
+			public static readonly Operator OR = new Operator("OR");
+			public static readonly Operator AND = new Operator("AND");
+		}
+		
+		/// <summary>Parses a query string, returning a {@link Lucene.Net.search.Query}.</summary>
 		/// <param name="query"> the query string to be parsed.
 		/// </param>
-		/// <param name="field"> the default Field for query terms.
+		/// <param name="field"> the default field for query terms.
 		/// </param>
 		/// <param name="analyzer">  used to find terms in the query text.
 		/// </param>
 		/// <throws>  ParseException if the parsing fails </throws>
+		/// <summary> 
+		/// </summary>
+		/// <deprecated> Use an instance of QueryParser and the {@link #Parse(String)} method instead.
+		/// </deprecated>
 		static public Query Parse(System.String query, System.String field, Analyzer analyzer)
 		{
 			QueryParser parser = new QueryParser(field, analyzer);
@@ -112,7 +146,7 @@
 		}
 		
 		/// <summary>Constructs a query parser.</summary>
-		/// <param name="f"> the default Field for query terms.
+		/// <param name="f"> the default field for query terms.
 		/// </param>
 		/// <param name="a">  used to find terms in the query text.
 		/// </param>
@@ -122,9 +156,7 @@
 			field = f;
 		}
 		
-		/// <summary>Parses a query string, returning a
-		/// <a href="lucene.search.Query.html">Query</a>.
-		/// </summary>
+		/// <summary>Parses a query string, returning a {@link Lucene.Net.search.Query}.</summary>
 		/// <param name="query"> the query string to be parsed.
 		/// </param>
 		/// <throws>  ParseException if the parsing fails </throws>
@@ -139,37 +171,55 @@
 			{
 				throw new ParseException(tme.Message);
 			}
-			catch (BooleanQuery.TooManyClauses tmc)
+			catch (BooleanQuery.TooManyClauses)
 			{
 				throw new ParseException("Too many boolean clauses");
 			}
 		}
 		
-        /// <returns> Returns the analyzer.
-        /// </returns>
-        public virtual Analyzer GetAnalyzer()
-        {
-            return analyzer;
-        }
-		
-        /// <returns> Returns the field.
-        /// </returns>
-        public virtual System.String GetField()
-        {
-            return field;
-        }
-		
-        /// <summary> Get the default minimal similarity for fuzzy queries.</summary>
-        public virtual float GetFuzzyMinSim()
-        {
-            return fuzzyMinSim;
-        }
-		
-        /// <summary>Set the default minimum similarity for fuzzy queries.</summary>
-        public virtual void  SetFuzzyMinSim(float fuzzyMinSim)
-        {
-            this.fuzzyMinSim = fuzzyMinSim;
-        }
+		/// <returns> Returns the analyzer.
+		/// </returns>
+		public virtual Analyzer GetAnalyzer()
+		{
+			return analyzer;
+		}
+		
+		/// <returns> Returns the field.
+		/// </returns>
+		public virtual System.String GetField()
+		{
+			return field;
+		}
+		
+		/// <summary> Get the minimal similarity for fuzzy queries.</summary>
+		public virtual float GetFuzzyMinSim()
+		{
+			return fuzzyMinSim;
+		}
+		
+		/// <summary> Set the minimum similarity for fuzzy queries.
+		/// Default is 0.5f.
+		/// </summary>
+		public virtual void  SetFuzzyMinSim(float fuzzyMinSim)
+		{
+			this.fuzzyMinSim = fuzzyMinSim;
+		}
+		
+		/// <summary> Get the prefix length for fuzzy queries. </summary>
+		/// <returns> Returns the fuzzyPrefixLength.
+		/// </returns>
+		public virtual int GetFuzzyPrefixLength()
+		{
+			return fuzzyPrefixLength;
+		}
+		
+		/// <summary> Set the prefix length for fuzzy queries. Default is 0.</summary>
+		/// <param name="fuzzyPrefixLength">The fuzzyPrefixLength to set.
+		/// </param>
+		public virtual void  SetFuzzyPrefixLength(int fuzzyPrefixLength)
+		{
+			this.fuzzyPrefixLength = fuzzyPrefixLength;
+		}
 		
 		/// <summary> Sets the default slop for phrases.  If zero, then exact phrase matches
 		/// are required.  Default value is zero.
@@ -186,33 +236,91 @@
 		}
 		
 		/// <summary> Sets the boolean operator of the QueryParser.
-		/// In classic mode (<code>DEFAULT_OPERATOR_OR</code>) terms without any modifiers
+		/// In default mode (<code>DEFAULT_OPERATOR_OR</code>) terms without any modifiers
 		/// are considered optional: for example <code>capital of Hungary</code> is equal to
 		/// <code>capital OR of OR Hungary</code>.<br/>
 		/// In <code>DEFAULT_OPERATOR_AND</code> terms are considered to be in conjuction: the
 		/// above mentioned query is parsed as <code>capital AND of AND Hungary</code>
 		/// </summary>
-		public virtual void  SetOperator(int operator_Renamed)
+		/// <deprecated> use {@link #SetDefaultOperator(QueryParser.Operator)} instead
+		/// </deprecated>
+		public virtual void  SetOperator(int op)
+		{
+			if (op == DEFAULT_OPERATOR_AND)
+				this.operator_Renamed = AND_OPERATOR;
+			else if (op == DEFAULT_OPERATOR_OR)
+				this.operator_Renamed = OR_OPERATOR;
+			else
+				throw new System.ArgumentException("Unknown operator " + op);
+		}
+		
+		/// <summary> Sets the boolean operator of the QueryParser.
+		/// In default mode (<code>OR_OPERATOR</code>) terms without any modifiers
+		/// are considered optional: for example <code>capital of Hungary</code> is equal to
+		/// <code>capital OR of OR Hungary</code>.<br/>
+		/// In <code>AND_OPERATOR</code> mode terms are considered to be in conjuction: the
+		/// above mentioned query is parsed as <code>capital AND of AND Hungary</code>
+		/// </summary>
+		public virtual void  SetDefaultOperator(Operator op)
 		{
-			this.operator_Renamed = operator_Renamed;
+			this.operator_Renamed = op;
 		}
 		
 		/// <summary> Gets implicit operator setting, which will be either DEFAULT_OPERATOR_AND
 		/// or DEFAULT_OPERATOR_OR.
 		/// </summary>
+		/// <deprecated> use {@link #GetDefaultOperator()} instead
+		/// </deprecated>
 		public virtual int GetOperator()
 		{
+			if (operator_Renamed == AND_OPERATOR)
+				return DEFAULT_OPERATOR_AND;
+			else if (operator_Renamed == OR_OPERATOR)
+				return DEFAULT_OPERATOR_OR;
+			else
+			{
+				throw new System.SystemException("Unknown operator " + operator_Renamed);
+			}
+		}
+		
+		/// <summary> Gets implicit operator setting, which will be either AND_OPERATOR
+		/// or OR_OPERATOR.
+		/// </summary>
+		public virtual Operator GetDefaultOperator()
+		{
 			return operator_Renamed;
 		}
 		
-		public virtual void  SetLowercaseWildcardTerms(bool lowercaseWildcardTerms)
+		/// <summary> Whether terms of wildcard, prefix, fuzzy and range queries are to be automatically
+		/// lower-cased or not.  Default is <code>true</code>.
+		/// </summary>
+		/// <deprecated> use {@link #SetLowercaseExpandedTerms(boolean)} instead
+		/// </deprecated>
+		public virtual void  SetLowercaseWildcardTerms(bool lowercaseExpandedTerms)
+		{
+			this.lowercaseExpandedTerms = lowercaseExpandedTerms;
+		}
+		
+		/// <summary> Whether terms of wildcard, prefix, fuzzy and range queries are to be automatically
+		/// lower-cased or not.  Default is <code>true</code>.
+		/// </summary>
+		public virtual void  SetLowercaseExpandedTerms(bool lowercaseExpandedTerms)
 		{
-			this.lowercaseWildcardTerms = lowercaseWildcardTerms;
+			this.lowercaseExpandedTerms = lowercaseExpandedTerms;
 		}
 		
+		/// <deprecated> use {@link #GetLowercaseExpandedTerms()} instead
+		/// </deprecated>
 		public virtual bool GetLowercaseWildcardTerms()
 		{
-			return lowercaseWildcardTerms;
+			return lowercaseExpandedTerms;
+		}
+		
+		/// <seealso cref="SetLowercaseExpandedTerms(boolean)">
+		/// </seealso>
+		public virtual bool GetLowercaseExpandedTerms()
+		{
+			return lowercaseExpandedTerms;
 		}
 		
 		/// <summary> Set locale used by date range parsing.</summary>
@@ -236,19 +344,19 @@
 			if (clauses.Count > 0 && conj == CONJ_AND)
 			{
 				BooleanClause c = (BooleanClause) clauses[clauses.Count - 1];
-				if (!c.prohibited)
-					c.required = true;
+				if (!c.IsProhibited())
+					c.SetOccur(BooleanClause.Occur.MUST);
 			}
 			
-			if (clauses.Count > 0 && operator_Renamed == DEFAULT_OPERATOR_AND && conj == CONJ_OR)
+			if (clauses.Count > 0 && operator_Renamed == AND_OPERATOR && conj == CONJ_OR)
 			{
 				// If this term is introduced by OR, make the preceding term optional,
 				// unless it's prohibited (that means we leave -a OR b but +a OR b-->a OR b)
 				// notice if the input is a OR b, first term is parsed as required; without
 				// this modification a OR b would parsed as +a OR b
 				BooleanClause c = (BooleanClause) clauses[clauses.Count - 1];
-				if (!c.prohibited)
-					c.required = false;
+				if (!c.IsProhibited())
+					c.SetOccur(BooleanClause.Occur.SHOULD);
 			}
 			
 			// We might have been passed a null query; the term might have been
@@ -256,7 +364,7 @@
 			if (q == null)
 				return ;
 			
-			if (operator_Renamed == DEFAULT_OPERATOR_OR)
+			if (operator_Renamed == OR_OPERATOR)
 			{
 				// We set REQUIRED if we're introduced by AND or +; PROHIBITED if
 				// introduced by NOT or -; make sure not to set both.
@@ -274,23 +382,30 @@
 				prohibited = (mods == MOD_NOT);
 				required = (!prohibited && conj != CONJ_OR);
 			}
-			clauses.Add(new BooleanClause(q, required, prohibited));
+			if (required && !prohibited)
+				clauses.Add(new BooleanClause(q, BooleanClause.Occur.MUST));
+			else if (!required && !prohibited)
+				clauses.Add(new BooleanClause(q, BooleanClause.Occur.SHOULD));
+			else if (!required && prohibited)
+				clauses.Add(new BooleanClause(q, BooleanClause.Occur.MUST_NOT));
+			else
+				throw new System.SystemException("Clause cannot be both required and prohibited");
 		}
 		
-        /// <summary> Note that parameter analyzer is ignored. Calls inside the parser always
-        /// use class member analyser. This method will be deprecated and substituted
-        /// by {@link #GetFieldQuery(String, String)} in future versions of Lucene.
-        /// Currently overwriting either of these methods works.
-        /// 
-        /// </summary>
-        /// <exception cref=""> ParseException throw in overridden method to disallow
-        /// </exception>
-        protected internal virtual Query GetFieldQuery(System.String field, Analyzer analyzer, System.String queryText)
-        {
-            return GetFieldQuery(field, queryText);
-        }
+		/// <summary> Note that parameter analyzer is ignored. Calls inside the parser always
+		/// use class member analyzer.
+		/// 
+		/// </summary>
+		/// <exception cref="ParseException">throw in overridden method to disallow
+		/// </exception>
+		/// <deprecated> use {@link #GetFieldQuery(String, String)}
+		/// </deprecated>
+		protected internal virtual Query GetFieldQuery(System.String field, Analyzer analyzer, System.String queryText)
+		{
+			return GetFieldQuery(field, queryText);
+		}
 		
-        /// <exception cref=""> ParseException throw in overridden method to disallow
+		/// <exception cref="ParseException">throw in overridden method to disallow
 		/// </exception>
 		protected internal virtual Query GetFieldQuery(System.String field, System.String queryText)
 		{
@@ -300,6 +415,8 @@
 			TokenStream source = analyzer.TokenStream(field, new System.IO.StringReader(queryText));
 			System.Collections.ArrayList v = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
 			Lucene.Net.Analysis.Token t;
+			int positionCount = 0;
+			bool severalTokensAtSamePosition = false;
 			
 			while (true)
 			{
@@ -313,7 +430,11 @@
 				}
 				if (t == null)
 					break;
-				v.Add(t.TermText());
+				v.Add(t);
+				if (t.GetPositionIncrement() != 0)
+					positionCount += t.GetPositionIncrement();
+				else
+					severalTokensAtSamePosition = true;
 			}
 			try
 			{
@@ -327,42 +448,77 @@
 			if (v.Count == 0)
 				return null;
 			else if (v.Count == 1)
-				return new TermQuery(new Term(field, (System.String) v[0]));
+			{
+				t = (Lucene.Net.Analysis.Token) v[0];
+				return new TermQuery(new Term(field, t.TermText()));
+			}
 			else
 			{
-				PhraseQuery q = new PhraseQuery();
-				q.SetSlop(phraseSlop);
-				for (int i = 0; i < v.Count; i++)
-				{
-					q.Add(new Term(field, (System.String) v[i]));
-				}
-				return q;
+				if (severalTokensAtSamePosition)
+				{
+					if (positionCount == 1)
+					{
+						// no phrase query:
+						BooleanQuery q = new BooleanQuery(true);
+						for (int i = 0; i < v.Count; i++)
+						{
+							t = (Lucene.Net.Analysis.Token) v[i];
+							TermQuery currentQuery = new TermQuery(new Term(field, t.TermText()));
+							q.Add(currentQuery, BooleanClause.Occur.SHOULD);
+						}
+						return q;
+					}
+					else
+					{
+						// phrase query:
+						MultiPhraseQuery mpq = new MultiPhraseQuery();
+						System.Collections.ArrayList multiTerms = new System.Collections.ArrayList();
+						for (int i = 0; i < v.Count; i++)
+						{
+							t = (Lucene.Net.Analysis.Token) v[i];
+							if (t.GetPositionIncrement() == 1 && multiTerms.Count > 0)
+							{
+								mpq.Add((Term[]) multiTerms.ToArray(typeof(Term)));
+								multiTerms.Clear();
+							}
+							multiTerms.Add(new Term(field, t.TermText()));
+						}
+						mpq.Add((Term[]) multiTerms.ToArray(typeof(Term)));
+						return mpq;
+					}
+				}
+				else
+				{
+					PhraseQuery q = new PhraseQuery();
+					q.SetSlop(phraseSlop);
+					for (int i = 0; i < v.Count; i++)
+					{
+						q.Add(new Term(field, ((Lucene.Net.Analysis.Token) v[i]).TermText()));
+					}
+					return q;
+				}
 			}
 		}
 		
-        /// <summary> Base implementation delegates to {@link #GetFieldQuery(String, Analyzer, String)}.
-        /// This method may be overwritten, for example, to return
-        /// a SpanNearQuery instead of a PhraseQuery.
-        /// 
-        /// Note that parameter analyzer is ignored. Calls inside the parser always
-        /// use class member analyser. This method will be deprecated and substituted
-        /// by {@link #GetFieldQuery(String, String, int)} in future versions of Lucene.
-        /// Currently overwriting either of these methods works.
-        /// 
-        /// </summary>
-        /// <exception cref=""> ParseException throw in overridden method to disallow
-        /// </exception>
-        protected internal virtual Query GetFieldQuery(System.String field, Analyzer analyzer, System.String queryText, int slop)
-        {
-            return GetFieldQuery(field, queryText, slop);
-        }
+		/// <summary> Note that parameter analyzer is ignored. Calls inside the parser always
+		/// use class member analyzer.
+		/// 
+		/// </summary>
+		/// <exception cref="ParseException">throw in overridden method to disallow
+		/// </exception>
+		/// <deprecated> use {@link #GetFieldQuery(String, String, int)}
+		/// </deprecated>
+		protected internal virtual Query GetFieldQuery(System.String field, Analyzer analyzer, System.String queryText, int slop)
+		{
+			return GetFieldQuery(field, queryText, slop);
+		}
 		
-        /// <summary> Base implementation delegates to {@link #GetFieldQuery(String,String)}.
+		/// <summary> Base implementation delegates to {@link #GetFieldQuery(String,String)}.
 		/// This method may be overridden, for example, to return
 		/// a SpanNearQuery instead of a PhraseQuery.
 		/// 
 		/// </summary>
-		/// <exception cref=""> ParseException throw in overridden method to disallow
+		/// <exception cref="ParseException">throw in overridden method to disallow
 		/// </exception>
 		protected internal virtual Query GetFieldQuery(System.String field, System.String queryText, int slop)
 		{
@@ -372,34 +528,43 @@
 			{
 				((PhraseQuery) query).SetSlop(slop);
 			}
+			if (query is MultiPhraseQuery)
+			{
+				((MultiPhraseQuery) query).SetSlop(slop);
+			}
 			
 			return query;
 		}
 		
-        /// <summary> Note that parameter analyzer is ignored. Calls inside the parser always
-        /// use class member analyser. This method will be deprecated and substituted
-        /// by {@link #GetRangeQuery(String, String, String, boolean)} in future versions of Lucene.
-        /// Currently overwriting either of these methods works.
-        /// 
-        /// </summary>
-        /// <exception cref=""> ParseException throw in overridden method to disallow
-        /// </exception>
-        protected internal virtual Query GetRangeQuery(System.String field, Analyzer analyzer, System.String part1, System.String part2, bool inclusive)
-        {
-            return GetRangeQuery(field, part1, part2, inclusive);
-        }
+		/// <summary> Note that parameter analyzer is ignored. Calls inside the parser always
+		/// use class member analyzer.
+		/// 
+		/// </summary>
+		/// <exception cref="ParseException">throw in overridden method to disallow
+		/// </exception>
+		/// <deprecated> use {@link #GetRangeQuery(String, String, String, boolean)}
+		/// </deprecated>
+		protected internal virtual Query GetRangeQuery(System.String field, Analyzer analyzer, System.String part1, System.String part2, bool inclusive)
+		{
+			return GetRangeQuery(field, part1, part2, inclusive);
+		}
 		
-        /// <exception cref=""> ParseException throw in overridden method to disallow
+		/// <exception cref="ParseException">throw in overridden method to disallow
 		/// </exception>
 		protected internal virtual Query GetRangeQuery(System.String field, System.String part1, System.String part2, bool inclusive)
 		{
+			if (lowercaseExpandedTerms)
+			{
+				part1 = part1.ToLower();
+				part2 = part2.ToLower();
+			}
 			try
 			{
-                System.DateTime d1 = DateTime.Parse(part1, locale);
-                System.DateTime d2 = DateTime.Parse(part2, locale);
+                System.DateTime d1 = System.DateTime.Parse(part1, locale);
+                System.DateTime d2 = System.DateTime.Parse(part2, locale);
                 part1 = DateField.DateToString(d1);
                 part2 = DateField.DateToString(d2);
-			}
+            }
 			catch (System.Exception e)
 			{
 			}
@@ -420,11 +585,33 @@
 		/// </param>
 		/// <returns> Resulting {@link Query} object.
 		/// </returns>
-		/// <exception cref=""> ParseException throw in overridden method to disallow
+		/// <exception cref="ParseException">throw in overridden method to disallow
 		/// </exception>
 		protected internal virtual Query GetBooleanQuery(System.Collections.ArrayList clauses)
 		{
-			BooleanQuery query = new BooleanQuery();
+			return GetBooleanQuery(clauses, false);
+		}
+		
+		/// <summary> Factory method for generating query, given a set of clauses.
+		/// By default creates a boolean query composed of clauses passed in.
+		/// 
+		/// Can be overridden by extending classes, to modify query being
+		/// returned.
+		/// 
+		/// </summary>
+		/// <param name="clauses">Vector that contains {@link BooleanClause} instances
+		/// to join.
+		/// </param>
+		/// <param name="disableCoord">true if coord scoring should be disabled.
+		/// 
+		/// </param>
+		/// <returns> Resulting {@link Query} object.
+		/// </returns>
+		/// <exception cref="ParseException">throw in overridden method to disallow
+		/// </exception>
+		protected internal virtual Query GetBooleanQuery(System.Collections.ArrayList clauses, bool disableCoord)
+		{
+			BooleanQuery query = new BooleanQuery(disableCoord);
 			for (int i = 0; i < clauses.Count; i++)
 			{
 				query.Add((BooleanClause) clauses[i]);
@@ -446,7 +633,7 @@
 		/// wildcard queries, which may be necessary due to missing analyzer calls.
 		/// 
 		/// </summary>
-		/// <param name="field">Name of the Field query will use.
+		/// <param name="field">Name of the field query will use.
 		/// </param>
 		/// <param name="termStr">Term token that contains one or more wild card
 		/// characters (? or *), but is not simple prefix term
@@ -454,11 +641,11 @@
 		/// </param>
 		/// <returns> Resulting {@link Query} built for the term
 		/// </returns>
-		/// <exception cref=""> ParseException throw in overridden method to disallow
+		/// <exception cref="ParseException">throw in overridden method to disallow
 		/// </exception>
 		protected internal virtual Query GetWildcardQuery(System.String field, System.String termStr)
 		{
-			if (lowercaseWildcardTerms)
+			if (lowercaseExpandedTerms)
 			{
 				termStr = termStr.ToLower();
 			}
@@ -467,7 +654,7 @@
 		}
 		
 		/// <summary> Factory method for generating a query (similar to
-		/// ({@link #getWildcardQuery}). Called when parser parses an input term
+		/// {@link #getWildcardQuery}). Called when parser parses an input term
 		/// token that uses prefix notation; that is, contains a single '*' wildcard
 		/// character as its last character. Since this is a special case
 		/// of generic wildcard term, and such a query can be optimized easily,
@@ -482,7 +669,7 @@
 		/// wild card queries, which may be necessary due to missing analyzer calls.
 		/// 
 		/// </summary>
-		/// <param name="field">Name of the Field query will use.
+		/// <param name="field">Name of the field query will use.
 		/// </param>
 		/// <param name="termStr">Term token to use for building term for the query
 		/// (<b>without</b> trailing '*' character!)
@@ -490,11 +677,11 @@
 		/// </param>
 		/// <returns> Resulting {@link Query} built for the term
 		/// </returns>
-		/// <exception cref=""> ParseException throw in overridden method to disallow
+		/// <exception cref="ParseException">throw in overridden method to disallow
 		/// </exception>
 		protected internal virtual Query GetPrefixQuery(System.String field, System.String termStr)
 		{
-			if (lowercaseWildcardTerms)
+			if (lowercaseExpandedTerms)
 			{
 				termStr = termStr.ToLower();
 			}
@@ -502,48 +689,38 @@
 			return new PrefixQuery(t);
 		}
 		
-        /// <summary> Factory method for generating a query (similar to
-        /// ({@link #getWildcardQuery}). Called when parser parses
-        /// an input term token that has the fuzzy suffix (~) appended.
-        /// 
-        /// </summary>
-        /// <param name="field">Name of the field query will use.
-        /// </param>
-        /// <param name="termStr">Term token to use for building term for the query
-        /// 
-        /// </param>
-        /// <returns> Resulting {@link Query} built for the term
-        /// </returns>
-        /// <exception cref=""> ParseException throw in overridden method to disallow
-        /// </exception>
-        protected internal virtual Query GetFuzzyQuery(System.String field, System.String termStr)
-        {
-            return GetFuzzyQuery(field, termStr, fuzzyMinSim);
-        }
-		
-        /// <summary> Factory method for generating a query (similar to
-        /// ({@link #getWildcardQuery}). Called when parser parses
-        /// an input term token that has the fuzzy suffix (~floatNumber) appended.
-        /// 
-        /// </summary>
-        /// <param name="field">Name of the field query will use.
-        /// </param>
-        /// <param name="termStr">Term token to use for building term for the query
-        /// </param>
-        /// <param name="minSimilarity">the minimum similarity required for a fuzzy match
-        /// 
-        /// </param>
-        /// <returns> Resulting {@link Query} built for the term
-        /// </returns>
-        /// <exception cref=""> ParseException throw in overridden method to disallow
-        /// </exception>
-        protected internal virtual Query GetFuzzyQuery(System.String field, System.String termStr, float minSimilarity)
-        {
-            Term t = new Term(field, termStr);
-            return new FuzzyQuery(t, minSimilarity);
-        }
+		/// <deprecated> use {@link #GetFuzzyQuery(String, String, float)}
+		/// </deprecated>
+		protected internal virtual Query GetFuzzyQuery(System.String field, System.String termStr)
+		{
+			return GetFuzzyQuery(field, termStr, fuzzyMinSim);
+		}
+		
+		/// <summary> Factory method for generating a query (similar to
+		/// {@link #getWildcardQuery}). Called when parser parses
+		/// an input term token that has the fuzzy suffix (~) appended.
+		/// 
+		/// </summary>
+		/// <param name="field">Name of the field query will use.
+		/// </param>
+		/// <param name="termStr">Term token to use for building term for the query
+		/// 
+		/// </param>
+		/// <returns> Resulting {@link Query} built for the term
+		/// </returns>
+		/// <exception cref="ParseException">throw in overridden method to disallow
+		/// </exception>
+		protected internal virtual Query GetFuzzyQuery(System.String field, System.String termStr, float minSimilarity)
+		{
+			if (lowercaseExpandedTerms)
+			{
+				termStr = termStr.ToLower();
+			}
+			Term t = new Term(field, termStr);
+			return new FuzzyQuery(t, minSimilarity, fuzzyPrefixLength);
+		}
 		
-        /// <summary> Returns a String where the escape char has been
+		/// <summary> Returns a String where the escape char has been
 		/// removed, or kept only once if there was a double escape.
 		/// </summary>
 		private System.String DiscardEscapeChar(System.String input)
@@ -561,31 +738,40 @@
 			return new System.String(caDest, 0, j);
 		}
 		
-        /// <summary> Returns a String where those characters that QueryParser
-        /// expects to be escaped are escaped, i.e. preceded by a <code>\</code>.
-        /// </summary>
-        public static System.String Escape(System.String s)
-        {
-            System.Text.StringBuilder sb = new System.Text.StringBuilder();
-            for (int i = 0; i < s.Length; i++)
-            {
-                char c = s[i];
-                // NOTE: keep this in sync with _ESCAPED_CHAR below!
-                if (c == '\\' || c == '+' || c == '-' || c == '!' || c == '(' || c == ')' || c == ':' || c == '^' || c == '[' || c == ']' || c == '\"' || c == '{' || c == '}' || c == '~' || c == '*' || c == '?')
-                {
-                    sb.Append('\\');
-                }
-                sb.Append(c);
-            }
-            return sb.ToString();
-        }
+		/// <summary> Returns a String where those characters that QueryParser
+		/// expects to be escaped are escaped by a preceding <code>\</code>.
+		/// </summary>
+		public static System.String Escape(System.String s)
+		{
+			System.Text.StringBuilder sb = new System.Text.StringBuilder();
+			for (int i = 0; i < s.Length; i++)
+			{
+				char c = s[i];
+				// NOTE: keep this in sync with _ESCAPED_CHAR below!
+				if (c == '\\' || c == '+' || c == '-' || c == '!' || c == '(' || c == ')' || c == ':' || c == '^' || c == '[' || c == ']' || c == '\"' || c == '{' || c == '}' || c == '~' || c == '*' || c == '?')
+				{
+					sb.Append('\\');
+				}
+				sb.Append(c);
+			}
+			return sb.ToString();
+		}
 		
-        [STAThread]
+		/// <summary> Command line tool to test QueryParser, using {@link Lucene.Net.analysis.SimpleAnalyzer}.
+		/// Usage:<br>
+		/// <code>java Lucene.Net.queryParser.QueryParser &lt;input&gt;</code>
+		/// </summary>
+		[STAThread]
 		public static void  Main(System.String[] args)
 		{
-			QueryParser qp = new QueryParser("Field", new Lucene.Net.Analysis.SimpleAnalyzer());
+			if (args.Length == 0)
+			{
+				System.Console.Out.WriteLine("Usage: java Lucene.Net.queryParser.QueryParser <input>");
+				System.Environment.Exit(0);
+			}
+			QueryParser qp = new QueryParser("field", new Lucene.Net.Analysis.SimpleAnalyzer());
 			Query q = qp.Parse(args[0]);
-			System.Console.Out.WriteLine(q.ToString("Field"));
+			System.Console.Out.WriteLine(q.ToString("field"));
 		}
 		
 		// *   Query  ::= ( Clause )*
@@ -598,7 +784,7 @@
 				
 				case Lucene.Net.QueryParsers.QueryParserConstants.AND: 
 				case Lucene.Net.QueryParsers.QueryParserConstants.OR: 
-					switch ((jj_ntk == - 1)?Jj_ntk():jj_ntk)
+					switch ((jj_ntk == - 1) ? Jj_ntk() : jj_ntk)
 					{
 						
 						case Lucene.Net.QueryParsers.QueryParserConstants.AND: 
@@ -635,13 +821,13 @@
 		public int Modifiers()
 		{
 			int ret = MOD_NONE;
-			switch ((jj_ntk == - 1)?Jj_ntk():jj_ntk)
+			switch ((jj_ntk == - 1) ? Jj_ntk() : jj_ntk)
 			{
 				
 				case Lucene.Net.QueryParsers.QueryParserConstants.NOT: 
 				case Lucene.Net.QueryParsers.QueryParserConstants.PLUS: 
 				case Lucene.Net.QueryParsers.QueryParserConstants.MINUS: 
-					switch ((jj_ntk == - 1)?Jj_ntk():jj_ntk)
+					switch ((jj_ntk == - 1) ? Jj_ntk() : jj_ntk)
 					{
 						
 						case Lucene.Net.QueryParsers.QueryParserConstants.PLUS: 
@@ -692,7 +878,7 @@
 				firstQuery = q;
 			while (true)
 			{
-				switch ((jj_ntk == -1) ? Jj_ntk() : jj_ntk)
+				switch ((jj_ntk == - 1) ? Jj_ntk() : jj_ntk)
 				{
 					
 					case Lucene.Net.QueryParsers.QueryParserConstants.AND: 
@@ -753,7 +939,7 @@
 			{
 				;
 			}
-			switch ((jj_ntk == -1) ? Jj_ntk() : jj_ntk)
+			switch ((jj_ntk == - 1) ? Jj_ntk() : jj_ntk)
 			{
 				
 				case Lucene.Net.QueryParsers.QueryParserConstants.QUOTED: 
@@ -770,7 +956,7 @@
 					Jj_consume_token(Lucene.Net.QueryParsers.QueryParserConstants.LPAREN);
 					q = Query(field);
 					Jj_consume_token(Lucene.Net.QueryParsers.QueryParserConstants.RPAREN);
-					switch ((jj_ntk == - 1)?Jj_ntk():jj_ntk)
+					switch ((jj_ntk == - 1) ? Jj_ntk() : jj_ntk)
 					{
 						
 						case Lucene.Net.QueryParsers.QueryParserConstants.CARAT: 
@@ -819,14 +1005,14 @@
 			bool fuzzy = false;
 			bool rangein = false;
 			Query q;
-			switch ((jj_ntk == -1) ? Jj_ntk() : jj_ntk)
+			switch ((jj_ntk == - 1) ? Jj_ntk() : jj_ntk)
 			{
 				
 				case Lucene.Net.QueryParsers.QueryParserConstants.TERM: 
 				case Lucene.Net.QueryParsers.QueryParserConstants.PREFIXTERM: 
 				case Lucene.Net.QueryParsers.QueryParserConstants.WILDTERM: 
 				case Lucene.Net.QueryParsers.QueryParserConstants.NUMBER: 
-					switch ((jj_ntk == - 1)?Jj_ntk():jj_ntk)
+					switch ((jj_ntk == - 1) ? Jj_ntk() : jj_ntk)
 					{
 						
 						case Lucene.Net.QueryParsers.QueryParserConstants.TERM: 
@@ -853,7 +1039,7 @@
 							throw new ParseException();
 						
 					}
-					switch ((jj_ntk == - 1)?Jj_ntk():jj_ntk)
+					switch ((jj_ntk == - 1) ? Jj_ntk() : jj_ntk)
 					{
 						
 						case Lucene.Net.QueryParsers.QueryParserConstants.FUZZY_SLOP: 
@@ -873,7 +1059,7 @@
 						case Lucene.Net.QueryParsers.QueryParserConstants.CARAT: 
 							Jj_consume_token(Lucene.Net.QueryParsers.QueryParserConstants.CARAT);
 							boost = Jj_consume_token(Lucene.Net.QueryParsers.QueryParserConstants.NUMBER);
-							switch ((jj_ntk == -1) ? Jj_ntk() : jj_ntk)
+							switch ((jj_ntk == - 1) ? Jj_ntk() : jj_ntk)
 							{
 								
 								case Lucene.Net.QueryParsers.QueryParserConstants.FUZZY_SLOP: 
@@ -906,25 +1092,25 @@
 					}
 					else if (fuzzy)
 					{
-                        float fms = fuzzyMinSim;
-                        try
-                        {
-                            fms = (float) System.Single.Parse(fuzzySlop.image.Substring(1));
-                        }
-                        catch (System.Exception ignored)
-                        {
-                        }
-                        if (fms < 0.0f || fms > 1.0f)
-                        {
-                            {
-                                if (true)
-                                    throw new ParseException("Minimum similarity for a FuzzyQuery has to be between 0.0f and 1.0f !");
-                            }
-                        }
-                        if (fms == fuzzyMinSim)
-                            q = GetFuzzyQuery(field, termImage);
-                        else
-                            q = GetFuzzyQuery(field, termImage, fms);
+						float fms = fuzzyMinSim;
+						try
+						{
+							fms = (float) System.Single.Parse(fuzzySlop.image.Substring(1));
+						}
+						catch (System.Exception ignored)
+						{
+						}
+						if (fms < 0.0f || fms > 1.0f)
+						{
+							{
+								if (true)
+									throw new ParseException("Minimum similarity for a FuzzyQuery has to be between 0.0f and 1.0f !");
+							}
+						}
+						if (fms == fuzzyMinSim)
+							q = GetFuzzyQuery(field, termImage);
+						else
+							q = GetFuzzyQuery(field, termImage, fms);
 					}
 					else
 					{
@@ -934,7 +1120,7 @@
 				
 				case Lucene.Net.QueryParsers.QueryParserConstants.RANGEIN_START: 
 					Jj_consume_token(Lucene.Net.QueryParsers.QueryParserConstants.RANGEIN_START);
-					switch ((jj_ntk == - 1)?Jj_ntk():jj_ntk)
+					switch ((jj_ntk == - 1) ? Jj_ntk() : jj_ntk)
 					{
 						
 						case Lucene.Net.QueryParsers.QueryParserConstants.RANGEIN_GOOP: 
@@ -951,7 +1137,7 @@
 							throw new ParseException();
 						
 					}
-					switch ((jj_ntk == - 1)?Jj_ntk():jj_ntk)
+					switch ((jj_ntk == - 1) ? Jj_ntk() : jj_ntk)
 					{
 						
 						case Lucene.Net.QueryParsers.QueryParserConstants.RANGEIN_TO: 
@@ -964,7 +1150,7 @@
 							break;
 						
 					}
-					switch ((jj_ntk == - 1)?Jj_ntk():jj_ntk)
+					switch ((jj_ntk == - 1) ? Jj_ntk() : jj_ntk)
 					{
 						
 						case Lucene.Net.QueryParsers.QueryParserConstants.RANGEIN_GOOP: 
@@ -982,7 +1168,7 @@
 						
 					}
 					Jj_consume_token(Lucene.Net.QueryParsers.QueryParserConstants.RANGEIN_END);
-					switch ((jj_ntk == - 1)?Jj_ntk():jj_ntk)
+					switch ((jj_ntk == - 1) ? Jj_ntk() : jj_ntk)
 					{
 						
 						case Lucene.Net.QueryParsers.QueryParserConstants.CARAT: 
@@ -1017,7 +1203,7 @@
 				
 				case Lucene.Net.QueryParsers.QueryParserConstants.RANGEEX_START: 
 					Jj_consume_token(Lucene.Net.QueryParsers.QueryParserConstants.RANGEEX_START);
-					switch ((jj_ntk == -1) ? Jj_ntk() : jj_ntk)
+					switch ((jj_ntk == - 1) ? Jj_ntk() : jj_ntk)
 					{
 						
 						case Lucene.Net.QueryParsers.QueryParserConstants.RANGEEX_GOOP: 
@@ -1034,7 +1220,7 @@
 							throw new ParseException();
 						
 					}
-					switch ((jj_ntk == -1) ? Jj_ntk() : jj_ntk)
+					switch ((jj_ntk == - 1) ? Jj_ntk() : jj_ntk)
 					{
 						
 						case Lucene.Net.QueryParsers.QueryParserConstants.RANGEEX_TO: 
@@ -1047,7 +1233,7 @@
 							break;
 						
 					}
-					switch ((jj_ntk == -1) ? Jj_ntk() : jj_ntk)
+					switch ((jj_ntk == - 1) ? Jj_ntk() : jj_ntk)
 					{
 						
 						case Lucene.Net.QueryParsers.QueryParserConstants.RANGEEX_GOOP: 
@@ -1065,7 +1251,7 @@
 						
 					}
 					Jj_consume_token(Lucene.Net.QueryParsers.QueryParserConstants.RANGEEX_END);
-					switch ((jj_ntk == -1) ? Jj_ntk() : jj_ntk)
+					switch ((jj_ntk == - 1) ? Jj_ntk() : jj_ntk)
 					{
 						
 						case Lucene.Net.QueryParsers.QueryParserConstants.CARAT: 
@@ -1101,7 +1287,7 @@
 				
 				case Lucene.Net.QueryParsers.QueryParserConstants.QUOTED: 
 					term = Jj_consume_token(Lucene.Net.QueryParsers.QueryParserConstants.QUOTED);
-					switch ((jj_ntk == -1) ? Jj_ntk() : jj_ntk)
+					switch ((jj_ntk == - 1) ? Jj_ntk() : jj_ntk)
 					{
 						
 						case Lucene.Net.QueryParsers.QueryParserConstants.FUZZY_SLOP: 
@@ -1114,7 +1300,7 @@
 							break;
 						
 					}
-					switch ((jj_ntk == -1) ? Jj_ntk() : jj_ntk)
+					switch ((jj_ntk == - 1) ? Jj_ntk() : jj_ntk)
 					{
 						
 						case Lucene.Net.QueryParsers.QueryParserConstants.CARAT: 
@@ -1145,7 +1331,7 @@
 				
 				default: 
 					jj_la1[21] = jj_gen;
-					Jj_consume_token(-1);
+					Jj_consume_token(- 1);
 					throw new ParseException();
 				
 			}
@@ -1211,10 +1397,10 @@
 		private bool jj_semLA;
 		private int jj_gen;
 		private int[] jj_la1 = new int[22];
-		private static uint[] jj_la1_0_Renamed_Field;
-		private static void  jj_la1_0()
+		private static uint[] jj_la1_0;
+		private static void  Jj_la1_0()
 		{
-            jj_la1_0_Renamed_Field = new uint[]{0x180, 0x180, 0xe00, 0xe00, 0xfb1f80, 0x8000, 0xfb1000, 0x9a0000, 0x40000, 0x40000, 0x8000, 0xc000000, 0x1000000, 0xc000000, 0x8000, 0xc0000000, 0x10000000, 0xc0000000, 0x8000, 0x40000, 0x8000, 0xfb0000};
+			jj_la1_0 = new uint[]{0x180, 0x180, 0xe00, 0xe00, 0xfb1f80, 0x8000, 0xfb1000, 0x9a0000, 0x40000, 0x40000, 0x8000, 0xc000000, 0x1000000, 0xc000000, 0x8000, 0xc0000000, 0x10000000, 0xc0000000, 0x8000, 0x40000, 0x8000, 0xfb0000};
 		}
 		private JJCalls[] jj_2_rtns;
 		private bool jj_rescan = false;
@@ -1222,7 +1408,7 @@
 		
 		public QueryParser(CharStream stream)
 		{
-            InitBlock();
+			InitBlock();
 			token_source = new QueryParserTokenManager(stream);
 			token = new Token();
 			jj_ntk = - 1;
@@ -1247,7 +1433,7 @@
 		
 		public QueryParser(QueryParserTokenManager tm)
 		{
-            InitBlock();
+			InitBlock();
 			token_source = tm;
 			token = new Token();
 			jj_ntk = - 1;
@@ -1306,7 +1492,7 @@
 		private sealed class LookaheadSuccess:System.ApplicationException
 		{
 		}
-		private LookaheadSuccess jj_ls = new LookaheadSuccess();
+		private LookaheadSuccess jj_ls;
 		private bool Jj_scan_token(int kind)
 		{
 			if (jj_scanpos == jj_lastpos)
@@ -1355,7 +1541,7 @@
 		
 		public Token GetToken(int index)
 		{
-			Token t = lookingAhead?jj_scanpos:token;
+			Token t = lookingAhead ? jj_scanpos : token;
 			for (int i = 0; i < index; i++)
 			{
 				if (t.next != null)
@@ -1424,8 +1610,8 @@
 		public virtual ParseException GenerateParseException()
 		{
 			jj_expentries.Clear();
-			bool[] la1tokens = new bool[33];
-			for (int i = 0; i < 33; i++)
+			bool[] la1tokens = new bool[32];
+			for (int i = 0; i < 32; i++)
 			{
 				la1tokens[i] = false;
 			}
@@ -1440,14 +1626,14 @@
 				{
 					for (int j = 0; j < 32; j++)
 					{
-						if ((jj_la1_0_Renamed_Field[i] & (1 << j)) != 0)
+						if ((jj_la1_0[i] & (1 << j)) != 0)
 						{
 							la1tokens[j] = true;
 						}
 					}
 				}
 			}
-			for (int i = 0; i < 33; i++)
+			for (int i = 0; i < 32; i++)
 			{
 				if (la1tokens[i])
 				{
@@ -1490,7 +1676,7 @@
 						{
 							
 							case 0:  Jj_3_1(); break;
-							}
+						}
 					}
 					p = p.next;
 				}
@@ -1523,7 +1709,7 @@
 		static QueryParser()
 		{
 			{
-				jj_la1_0();
+				Jj_la1_0();
 			}
 		}
 	}

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/QueryParserConstants.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/QueryParser/QueryParserConstants.cs?rev=411501&r1=411500&r2=411501&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/QueryParserConstants.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/QueryParserConstants.cs Sat Jun  3 19:41:13 2006
@@ -13,8 +13,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 /* Generated By:JavaCC: Do not edit this line. QueryParserConstants.java */
+
 using System;
+
 namespace Lucene.Net.QueryParsers
 {
 	
@@ -55,14 +58,6 @@
 		public const int RangeEx = 1;
 		public const int RangeIn = 2;
 		public const int DEFAULT = 3;
-		public static System.String[] tokenImage = new System.String[]
-        {
-            "<EOF>", "<_NUM_CHAR>", "<_ESCAPED_CHAR>", "<_TERM_START_CHAR>", "<_TERM_CHAR>", 
-            "<_WHITESPACE>", "<token of kind 6>", "<AND>", "<OR>", "<NOT>", "\"+\"", "\"-\"", 
-            "\"(\"", "\")\"", "\":\"", "\"^\"", "<QUOTED>", "<TERM>", "<FUZZY_SLOP>", 
-            "<PREFIXTERM>", "<WILDTERM>", "\"[\"", "\"{\"", "<NUMBER>", "\"TO\"", "\"]\"", 
-            "<RANGEIN_QUOTED>", "<RANGEIN_GOOP>", "\"TO\"", "\"}\"", "<RANGEEX_QUOTED>", 
-            "<RANGEEX_GOOP>"
-        };
-    }
+		public static System.String[] tokenImage = new System.String[]{"<EOF>", "<_NUM_CHAR>", "<_ESCAPED_CHAR>", "<_TERM_START_CHAR>", "<_TERM_CHAR>", "<_WHITESPACE>", "<token of kind 6>", "<AND>", "<OR>", "<NOT>", "\"+\"", "\"-\"", "\"(\"", "\")\"", "\":\"", "\"^\"", "<QUOTED>", "<TERM>", "<FUZZY_SLOP>", "<PREFIXTERM>", "<WILDTERM>", "\"[\"", "\"{\"", "<NUMBER>", "\"TO\"", "\"]\"", "<RANGEIN_QUOTED>", "<RANGEIN_GOOP>", "\"TO\"", "\"}\"", "<RANGEEX_QUOTED>", "<RANGEEX_GOOP>"};
+	}
 }

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/QueryParserTokenManager.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/QueryParser/QueryParserTokenManager.cs?rev=411501&r1=411500&r2=411501&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/QueryParserTokenManager.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/QueryParserTokenManager.cs Sat Jun  3 19:41:13 2006
@@ -13,13 +13,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 /* Generated By:JavaCC: Do not edit this line. QueryParserTokenManager.java */
+
 using System;
 using Lucene.Net.Analysis;
 using Lucene.Net.Documents;
 using Term = Lucene.Net.Index.Term;
 using Lucene.Net.Search;
 using Searchable = Lucene.Net.Search.Searchable;
+using Parameter = Lucene.Net.Util.Parameter;
+
 namespace Lucene.Net.QueryParsers
 {
 	
@@ -27,17 +31,17 @@
 	{
 		private void  InitBlock()
 		{
-            System.IO.StreamWriter temp_writer;
-            temp_writer = new System.IO.StreamWriter(System.Console.OpenStandardOutput(), System.Console.Out.Encoding);
-            temp_writer.AutoFlush = true;
-            debugStream = temp_writer;
-        }
+			System.IO.StreamWriter temp_writer;
+			temp_writer = new System.IO.StreamWriter(System.Console.OpenStandardOutput(), System.Console.Out.Encoding);
+			temp_writer.AutoFlush = true;
+			debugStream = temp_writer;
+		}
 		public System.IO.StreamWriter debugStream;
 		public virtual void  SetDebugStream(System.IO.StreamWriter ds)
 		{
 			debugStream = ds;
 		}
-		private int jjStopStringLiteralDfa_3(int pos, long active0)
+		private int JjStopStringLiteralDfa_3(int pos, long active0)
 		{
 			switch (pos)
 			{
@@ -47,117 +51,117 @@
 				
 			}
 		}
-        private int jjStartNfa_3(int pos, long active0)
-        {
-            return JjMoveNfa_3(jjStopStringLiteralDfa_3(pos, active0), pos + 1);
-        }
-        private int JjStopAtPos(int pos, int kind)
-        {
-            jjmatchedKind = kind;
-            jjmatchedPos = pos;
-            return pos + 1;
-        }
-        private int JjStartNfaWithStates_3(int pos, int kind, int state)
-        {
-            jjmatchedKind = kind;
-            jjmatchedPos = pos;
-            try
-            {
-                curChar = input_stream.ReadChar();
-            }
-            catch (System.IO.IOException e)
-            {
-                return pos + 1;
-            }
-            return JjMoveNfa_3(state, pos + 1);
-        }
-        private int JjMoveStringLiteralDfa0_3()
-        {
-            switch (curChar)
-            {
-				
-                case (char) (40): 
-                    return JjStopAtPos(0, 12);
-				
-                case (char) (41): 
-                    return JjStopAtPos(0, 13);
-				
-                case (char) (43): 
-                    return JjStopAtPos(0, 10);
-				
-                case (char) (45): 
-                    return JjStopAtPos(0, 11);
-				
-                case (char) (58): 
-                    return JjStopAtPos(0, 14);
-				
-                case (char) (91): 
-                    return JjStopAtPos(0, 21);
-				
-                case (char) (94): 
-                    return JjStopAtPos(0, 15);
-				
-                case (char) (123): 
-                    return JjStopAtPos(0, 22);
-				
-                default: 
-                    return JjMoveNfa_3(0, 0);
-				
-            }
-        }
-        private void  JjCheckNAdd(int state)
-        {
-            if (jjrounds[state] != jjround)
-            {
-                jjstateSet[jjnewStateCnt++] = state;
-                jjrounds[state] = jjround;
-            }
-        }
-        private void  JjAddStates(int start, int end)
-        {
-            do 
-            {
-                jjstateSet[jjnewStateCnt++] = jjnextStates[start];
-            }
-            while (start++ != end);
-        }
-        private void  JjCheckNAddTwoStates(int state1, int state2)
-        {
-            JjCheckNAdd(state1);
-            JjCheckNAdd(state2);
-        }
-        private void  JjCheckNAddStates(int start, int end)
-        {
-            do 
-            {
-                JjCheckNAdd(jjnextStates[start]);
-            }
-            while (start++ != end);
-        }
-        private void  JjCheckNAddStates(int start)
-        {
-            JjCheckNAdd(jjnextStates[start]);
-            JjCheckNAdd(jjnextStates[start + 1]);
-        }
-        internal static readonly ulong[] jjbitVec0 = new ulong[]{0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL};
-        internal static readonly ulong[] jjbitVec2 = new ulong[]{0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL};
-        private int JjMoveNfa_3(int startState, int curPos)
-        {
-            int[] nextStates;
-            int startsAt = 0;
-            jjnewStateCnt = 33;
-            int i = 1;
-            jjstateSet[0] = startState;
-            int j, kind = 0x7fffffff;
-            for (; ; )
-            {
-                if (++jjround == 0x7fffffff)
-                    ReInitRounds();
-                if (curChar < 64)
-                {
-                    ulong l = ((ulong) 1L) << curChar;
+		private int JjStartNfa_3(int pos, long active0)
+		{
+			return JjMoveNfa_3(JjStopStringLiteralDfa_3(pos, active0), pos + 1);
+		}
+		private int JjStopAtPos(int pos, int kind)
+		{
+			jjmatchedKind = kind;
+			jjmatchedPos = pos;
+			return pos + 1;
+		}
+		private int JjStartNfaWithStates_3(int pos, int kind, int state)
+		{
+			jjmatchedKind = kind;
+			jjmatchedPos = pos;
+			try
+			{
+				curChar = input_stream.ReadChar();
+			}
+			catch (System.IO.IOException)
+			{
+				return pos + 1;
+			}
+			return JjMoveNfa_3(state, pos + 1);
+		}
+		private int JjMoveStringLiteralDfa0_3()
+		{
+			switch (curChar)
+			{
+				
+				case (char) (40): 
+					return JjStopAtPos(0, 12);
+				
+				case (char) (41): 
+					return JjStopAtPos(0, 13);
+				
+				case (char) (43): 
+					return JjStopAtPos(0, 10);
+				
+				case (char) (45): 
+					return JjStopAtPos(0, 11);
+				
+				case (char) (58): 
+					return JjStopAtPos(0, 14);
+				
+				case (char) (91): 
+					return JjStopAtPos(0, 21);
+				
+				case (char) (94): 
+					return JjStopAtPos(0, 15);
+				
+				case (char) (123): 
+					return JjStopAtPos(0, 22);
+				
+				default: 
+					return JjMoveNfa_3(0, 0);
+				
+			}
+		}
+		private void  JjCheckNAdd(int state)
+		{
+			if (jjrounds[state] != jjround)
+			{
+				jjstateSet[jjnewStateCnt++] = state;
+				jjrounds[state] = jjround;
+			}
+		}
+		private void  JjAddStates(int start, int end)
+		{
+			do 
+			{
+				jjstateSet[jjnewStateCnt++] = jjnextStates[start];
+			}
+			while (start++ != end);
+		}
+		private void  JjCheckNAddTwoStates(int state1, int state2)
+		{
+			JjCheckNAdd(state1);
+			JjCheckNAdd(state2);
+		}
+		private void  JjCheckNAddStates(int start, int end)
+		{
+			do 
+			{
+				JjCheckNAdd(jjnextStates[start]);
+			}
+			while (start++ != end);
+		}
+		private void  JjCheckNAddStates(int start)
+		{
+			JjCheckNAdd(jjnextStates[start]);
+			JjCheckNAdd(jjnextStates[start + 1]);
+		}
+		internal static readonly ulong[] jjbitVec0 = new ulong[]{0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL};
+		internal static readonly ulong[] jjbitVec2 = new ulong[]{0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL};
+		private int JjMoveNfa_3(int startState, int curPos)
+		{
+			int[] nextStates;
+			int startsAt = 0;
+			jjnewStateCnt = 33;
+			int i = 1;
+			jjstateSet[0] = startState;
+			int j, kind = 0x7fffffff;
+			for (; ; )
+			{
+				if (++jjround == 0x7fffffff)
+					ReInitRounds();
+				if (curChar < 64)
+				{
+					ulong l = ((ulong) 1L) << curChar;
 MatchLoop: 
-                    do 
+					do 
 					{
 						switch (jjstateSet[--i])
 						{
@@ -224,9 +228,9 @@
 								break;
 							
 							case 19: 
-                                if (curChar == 46)
-                                    JjCheckNAdd(20);
-                                break;
+								if (curChar == 46)
+									JjCheckNAdd(20);
+								break;
 							
 							case 20: 
 								if ((0x3ff000000000000L & l) == (ulong) 0L)
@@ -236,15 +240,15 @@
 								JjCheckNAdd(20);
 								break;
 							
-                            case 21: 
-                                if ((0x7bffd0f8ffffd9ffL & l) == (ulong) 0L)
-                                    break;
-                                if (kind > 17)
-                                    kind = 17;
-                                JjCheckNAddStates(0, 6);
-                                break;
+							case 21: 
+								if ((0x7bffd0f8ffffd9ffL & l) == (ulong) 0L)
+									break;
+								if (kind > 17)
+									kind = 17;
+								JjCheckNAddStates(0, 6);
+								break;
 							
-                            case 22: 
+							case 22: 
 								if ((0x7bfff8f8ffffd9ffL & l) == (ulong) 0L)
 									break;
 								if (kind > 17)
@@ -253,45 +257,45 @@
 								break;
 							
 							case 24: 
-                                if ((0x84002f0600000000L & l) == (ulong) 0L)
-                                    break;
-                                if (kind > 17)
-                                    kind = 17;
-                                JjCheckNAddTwoStates(22, 23);
-                                break;
-							
-                            case 25: 
-                                if ((0x7bfff8f8ffffd9ffL & l) != (ulong) 0L)
-                                    JjCheckNAddStates(9, 11);
-                                break;
+								if ((0x84002f0600000000L & l) == (ulong) 0L)
+									break;
+								if (kind > 17)
+									kind = 17;
+								JjCheckNAddTwoStates(22, 23);
+								break;
+							
+							case 25: 
+								if ((0x7bfff8f8ffffd9ffL & l) != (ulong) 0L)
+									JjCheckNAddStates(9, 11);
+								break;
 							
 							case 26: 
-                                if (curChar == 42 && kind > 19)
-                                    kind = 19;
-                                break;
-							
-                            case 28: 
-                                if ((0x84002f0600000000L & l) != (ulong) 0L)
-                                    JjCheckNAddStates(9, 11);
-                                break;
+								if (curChar == 42 && kind > 19)
+									kind = 19;
+								break;
+							
+							case 28: 
+								if ((0x84002f0600000000L & l) != (ulong) 0L)
+									JjCheckNAddStates(9, 11);
+								break;
 							
 							case 29: 
-                                if ((0xfbfffcf8ffffd9ffL & l) == (ulong) 0L)
-                                    break;
-                                if (kind > 20)
-                                    kind = 20;
-                                JjCheckNAddTwoStates(29, 30);
-                                break;
-							
-                            case 31: 
-                                if ((0x84002f0600000000L & l) == (ulong) 0L)
-                                    break;
-                                if (kind > 20)
-                                    kind = 20;
-                                JjCheckNAddTwoStates(29, 30);
-                                break;
+								if ((0xfbfffcf8ffffd9ffL & l) == (ulong) 0L)
+									break;
+								if (kind > 20)
+									kind = 20;
+								JjCheckNAddTwoStates(29, 30);
+								break;
 							
-                            default:  break;
+							case 31: 
+								if ((0x84002f0600000000L & l) == (ulong) 0L)
+									break;
+								if (kind > 20)
+									kind = 20;
+								JjCheckNAddTwoStates(29, 30);
+								break;
+							
+							default:  break;
 							
 						}
 					}
@@ -314,12 +318,12 @@
 									JjCheckNAddStates(0, 6);
 								}
 								else if (curChar == 126)
-                                {
-                                    if (kind > 18)
-                                        kind = 18;
-                                    jjstateSet[jjnewStateCnt++] = 18;
-                                }
-                                if (curChar == 92)
+								{
+									if (kind > 18)
+										kind = 18;
+									jjstateSet[jjnewStateCnt++] = 18;
+								}
+								if (curChar == 92)
 									JjCheckNAddStates(12, 14);
 								else if (curChar == 78)
 									jjstateSet[jjnewStateCnt++] = 11;
@@ -382,24 +386,24 @@
 								break;
 							
 							case 15: 
-								JjAddStates(13, 16);
+								JjAddStates(15, 16);
 								break;
 							
 							case 17: 
-                                if (curChar != 126)
-                                    break;
-                                if (kind > 18)
-                                    kind = 18;
-                                jjstateSet[jjnewStateCnt++] = 18;
-                                break;
+								if (curChar != 126)
+									break;
+								if (kind > 18)
+									kind = 18;
+								jjstateSet[jjnewStateCnt++] = 18;
+								break;
 							
 							case 21: 
-                                if ((0x97ffffff97ffffffL & l) == (ulong) 0L)
-                                    break;
-                                if (kind > 17)
-                                    kind = 17;
-                                JjCheckNAddStates(0, 6);
-                                break;
+								if ((0x97ffffff97ffffffL & l) == (ulong) 0L)
+									break;
+								if (kind > 17)
+									kind = 17;
+								JjCheckNAddStates(0, 6);
+								break;
 							
 							case 22: 
 								if ((0x97ffffff97ffffffL & l) == (ulong) 0L)
@@ -410,60 +414,60 @@
 								break;
 							
 							case 23: 
-                                if (curChar == 92)
-                                    JjCheckNAddTwoStates(24, 24);
-                                break;
-							
-                            case 24: 
-                                if ((0x6800000078000000L & l) == (ulong) 0L)
-                                    break;
-                                if (kind > 17)
-                                    kind = 17;
-                                JjCheckNAddTwoStates(22, 23);
-                                break;
+								if (curChar == 92)
+									JjCheckNAddTwoStates(24, 24);
+								break;
+							
+							case 24: 
+								if ((0x6800000078000000L & l) == (ulong) 0L)
+									break;
+								if (kind > 17)
+									kind = 17;
+								JjCheckNAddTwoStates(22, 23);
+								break;
 							
 							case 25: 
-                                if ((0x97ffffff97ffffffL & l) != (ulong) 0L)
-                                    JjCheckNAddStates(9, 11);
-                                break;
+								if ((0x97ffffff97ffffffL & l) != (ulong) 0L)
+									JjCheckNAddStates(9, 11);
+								break;
 							
 							case 27: 
-                                if (curChar == 92)
-                                    JjCheckNAddTwoStates(28, 28);
-                                break;
+								if (curChar == 92)
+									JjCheckNAddTwoStates(28, 28);
+								break;
 							
 							case 28: 
-                                if ((0x6800000078000000L & l) != (ulong) 0L)
-                                    JjCheckNAddStates(9, 11);
-                                break;
+								if ((0x6800000078000000L & l) != (ulong) 0L)
+									JjCheckNAddStates(9, 11);
+								break;
 							
 							case 29: 
-                                if ((0x97ffffff97ffffffL & l) == (ulong) 0L)
-                                    break;
-                                if (kind > 20)
-                                    kind = 20;
-                                JjCheckNAddTwoStates(29, 30);
-                                break;
+								if ((0x97ffffff97ffffffL & l) == (ulong) 0L)
+									break;
+								if (kind > 20)
+									kind = 20;
+								JjCheckNAddTwoStates(29, 30);
+								break;
 							
 							case 30: 
 								if (curChar == 92)
 									JjCheckNAddTwoStates(31, 31);
 								break;
 							
-                            case 31: 
-                                if ((0x6800000078000000L & l) == (ulong) 0L)
-                                    break;
-                                if (kind > 20)
-                                    kind = 20;
-                                JjCheckNAddTwoStates(29, 30);
-                                break;
-							
-                            case 32: 
-                                if (curChar == 92)
-                                    JjCheckNAddStates(12, 14);
-                                break;
+							case 31: 
+								if ((0x6800000078000000L & l) == (ulong) 0L)
+									break;
+								if (kind > 20)
+									kind = 20;
+								JjCheckNAddTwoStates(29, 30);
+								break;
 							
-                            default:  break;
+							case 32: 
+								if (curChar == 92)
+									JjCheckNAddStates(12, 14);
+								break;
+							
+							default:  break;
 							
 						}
 					}
@@ -483,7 +487,7 @@
 						{
 							
 							case 0: 
-								if (!jjCanMove_0(hiByte, i1, i2, (ulong) l1, (ulong) l2))
+								if (!JjCanMove_0(hiByte, i1, i2, (ulong) l1, (ulong) l2))
 									break;
 								if (kind > 17)
 									kind = 17;
@@ -491,12 +495,12 @@
 								break;
 							
 							case 15: 
-								if (jjCanMove_0(hiByte, i1, i2, (ulong) l1, (ulong) l2))
+								if (JjCanMove_0(hiByte, i1, i2, (ulong) l1, (ulong) l2))
 									JjAddStates(15, 16);
 								break;
 							
 							case 22: 
-								if (!jjCanMove_0(hiByte, i1, i2, (ulong) l1, (ulong) l2))
+								if (!JjCanMove_0(hiByte, i1, i2, (ulong) l1, (ulong) l2))
 									break;
 								if (kind > 17)
 									kind = 17;
@@ -504,17 +508,17 @@
 								break;
 							
 							case 25: 
-								if (jjCanMove_0(hiByte, i1, i2, (ulong) l1, (ulong) l2))
+								if (JjCanMove_0(hiByte, i1, i2, (ulong) l1, (ulong) l2))
 									JjCheckNAddStates(9, 11);
 								break;
 							
 							case 29: 
-								if (!jjCanMove_0(hiByte, i1, i2, (ulong) l1, (ulong) l2))
+								if (!JjCanMove_0(hiByte, i1, i2, (ulong) l1, (ulong) l2))
 									break;
-                                if (kind > 20)
-                                    kind = 20;
-                                JjCheckNAddTwoStates(29, 30);
-                                break;
+								if (kind > 20)
+									kind = 20;
+								JjCheckNAddTwoStates(29, 30);
+								break;
 							
 							default:  break;
 							
@@ -535,7 +539,7 @@
 				{
 					curChar = input_stream.ReadChar();
 				}
-				catch (System.IO.IOException)
+				catch (System.IO.IOException e)
 				{
 					return curPos;
 				}
@@ -727,7 +731,7 @@
 							
 							case 0: 
 							case 4: 
-								if (!jjCanMove_0(hiByte, i1, i2, (ulong) l1, (ulong) l2))
+								if (!JjCanMove_0(hiByte, i1, i2, (ulong) l1, (ulong) l2))
 									break;
 								if (kind > 31)
 									kind = 31;
@@ -735,7 +739,7 @@
 								break;
 							
 							case 2: 
-								if (jjCanMove_0(hiByte, i1, i2, (ulong) l1, (ulong) l2))
+								if (JjCanMove_0(hiByte, i1, i2, (ulong) l1, (ulong) l2))
 									JjAddStates(17, 18);
 								break;
 							
@@ -790,12 +794,12 @@
 						{
 							
 							case 0: 
-                                if ((0x3ff000000000000L & l) == (ulong) 0L)
+								if ((0x3ff000000000000L & l) == (ulong) 0L)
 									break;
-                                if (kind > 23)
-                                    kind = 23;
-                                JjAddStates(19, 20);
-                                break;
+								if (kind > 23)
+									kind = 23;
+								JjAddStates(19, 20);
+								break;
 							
 							case 1: 
 								if (curChar == 46)
@@ -805,10 +809,10 @@
 							case 2: 
 								if ((0x3ff000000000000L & l) == (ulong) 0L)
 									break;
-                                if (kind > 23)
-                                    kind = 23;
-                                JjCheckNAdd(2);
-                                break;
+								if (kind > 23)
+									kind = 23;
+								JjCheckNAdd(2);
+								break;
 							
 							default:  break;
 							
@@ -1031,7 +1035,7 @@
 								break;
 							
 							case 2: 
-								JjAddStates(17, 16);
+								JjAddStates(17, 18);
 								break;
 							
 							default:  break;
@@ -1055,7 +1059,7 @@
 							
 							case 0: 
 							case 4: 
-								if (!jjCanMove_0(hiByte, i1, i2, (ulong) l1, (ulong) l2))
+								if (!JjCanMove_0(hiByte, i1, i2, (ulong) l1, (ulong) l2))
 									break;
 								if (kind > 27)
 									kind = 27;
@@ -1063,7 +1067,7 @@
 								break;
 							
 							case 2: 
-								if (jjCanMove_0(hiByte, i1, i2, (ulong) l1, (ulong) l2))
+								if (JjCanMove_0(hiByte, i1, i2, (ulong) l1, (ulong) l2))
 									JjAddStates(17, 18);
 								break;
 							
@@ -1092,8 +1096,8 @@
 				}
 			}
 		}
-        internal static readonly int[] jjnextStates = new int[]{22, 25, 26, 29, 30, 27, 23, 18, 19, 25, 26, 27, 24, 28, 31, 15, 16, 2, 3, 0, 1};
-		private static bool jjCanMove_0(int hiByte, int i1, int i2, ulong l1, ulong l2)
+		internal static readonly int[] jjnextStates = new int[]{22, 25, 26, 29, 30, 27, 23, 18, 19, 25, 26, 27, 24, 28, 31, 15, 16, 2, 3, 0, 1};
+		private static bool JjCanMove_0(int hiByte, int i1, int i2, ulong l1, ulong l2)
 		{
 			switch (hiByte)
 			{

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/Token.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/QueryParser/Token.cs?rev=411501&r1=411500&r2=411501&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/Token.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/Token.cs Sat Jun  3 19:41:13 2006
@@ -13,8 +13,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 /* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */
+
 using System;
+
 namespace Lucene.Net.QueryParsers
 {
 	
@@ -40,23 +43,23 @@
 		
 		/// <summary> A reference to the next regular (non-special) token from the input
 		/// stream.  If this is the last token from the input stream, or if the
-		/// token manager has not read tokens beyond this one, this Field is
+		/// token manager has not read tokens beyond this one, this field is
 		/// set to null.  This is true only if this token is also a regular
 		/// token.  Otherwise, see below for a description of the contents of
-		/// this Field.
+		/// this field.
 		/// </summary>
 		public Token next;
 		
-		/// <summary> This Field is used to access special tokens that occur prior to this
+		/// <summary> This field is used to access special tokens that occur prior to this
 		/// token, but after the immediately preceding regular (non-special) token.
-		/// If there are no such special tokens, this Field is set to null.
-		/// When there are more than one such special token, this Field refers
+		/// If there are no such special tokens, this field is set to null.
+		/// When there are more than one such special token, this field refers
 		/// to the last of these special tokens, which in turn refers to the next
-		/// previous special token through its specialToken Field, and so on
-		/// until the first special token (whose specialToken Field is null).
+		/// previous special token through its specialToken field, and so on
+		/// until the first special token (whose specialToken field is null).
 		/// The next fields of special tokens refer to other special tokens that
 		/// immediately follow it (without an intervening regular token).  If there
-		/// is no such token, this Field is null.
+		/// is no such token, this field is null.
 		/// </summary>
 		public Token specialToken;
 		

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/TokenMgrError.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/QueryParser/TokenMgrError.cs?rev=411501&r1=411500&r2=411501&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/TokenMgrError.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/TokenMgrError.cs Sat Jun  3 19:41:13 2006
@@ -13,8 +13,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 /* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 */
+
 using System;
+
 namespace Lucene.Net.QueryParsers
 {
 	

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/BooleanClause.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Search/BooleanClause.cs?rev=411501&r1=411500&r2=411501&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/BooleanClause.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/BooleanClause.cs Sat Jun  3 19:41:13 2006
@@ -13,32 +13,171 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 using System;
+using Parameter = Lucene.Net.Util.Parameter;
+
 namespace Lucene.Net.Search
 {
+	
 	/// <summary>A clause in a BooleanQuery. </summary>
 	[Serializable]
 	public class BooleanClause
 	{
-		/// <summary>The query whose matching documents are combined by the boolean query. </summary>
-		public Query query;
+		
+		[Serializable]
+		public sealed class Occur : Parameter
+		{
+			
+			internal Occur(System.String name):base(name)
+			{
+			}
+			
+			public override System.String ToString()
+			{
+				if (this == MUST)
+					return "+";
+				if (this == MUST_NOT)
+					return "-";
+				return "";
+			}
+			
+			/// <summary>Use this operator for terms that <i>must</i> appear in the matching documents. </summary>
+			public static readonly Occur MUST = new Occur("MUST");
+			/// <summary>Use this operator for terms that <i>should</i> appear in the 
+			/// matching documents. For a BooleanQuery with two <code>SHOULD</code> 
+			/// subqueries, at least one of the queries must appear in the matching documents. 
+			/// </summary>
+			public static readonly Occur SHOULD = new Occur("SHOULD");
+			/// <summary>Use this operator for terms that <i>must not</i> appear in the matching documents.
+			/// Note that it is not possible to search for queries that only consist
+			/// of a <code>MUST_NOT</code> query. 
+			/// </summary>
+			public static readonly Occur MUST_NOT = new Occur("MUST_NOT");
+		}
+		
+		/// <summary>The query whose matching documents are combined by the boolean query.</summary>
+		/// <deprecated> use {@link #SetQuery(Query)} instead 
+		/// </deprecated>
+		public Query query; // TODO: decrease visibility for Lucene 2.0
+		
 		/// <summary>If true, documents documents which <i>do not</i>
-		/// match this sub-query will <i>not</i> match the boolean query. 
+		/// match this sub-query will <i>not</i> match the boolean query.
 		/// </summary>
-		public bool required = false;
+		/// <deprecated> use {@link #SetOccur(BooleanClause.Occur)} instead 
+		/// </deprecated>
+		public bool required = false; // TODO: decrease visibility for Lucene 2.0
+		
 		/// <summary>If true, documents documents which <i>do</i>
-		/// match this sub-query will <i>not</i> match the boolean query. 
+		/// match this sub-query will <i>not</i> match the boolean query.
 		/// </summary>
-		public bool prohibited = false;
+		/// <deprecated> use {@link #SetOccur(BooleanClause.Occur)} instead 
+		/// </deprecated>
+		public bool prohibited = false; // TODO: decrease visibility for Lucene 2.0
+		
+		private Occur occur = Occur.SHOULD;
 		
 		/// <summary>Constructs a BooleanClause with query <code>q</code>, required
-		/// <code>r</code> and prohibited <code>p</code>. 
+		/// <code>r</code> and prohibited <code>p</code>.
 		/// </summary>
+		/// <deprecated> use BooleanClause(Query, Occur) instead
+		/// <ul>
+		/// <li>For BooleanClause(query, true, false) use BooleanClause(query, BooleanClause.Occur.MUST)
+		/// <li>For BooleanClause(query, false, false) use BooleanClause(query, BooleanClause.Occur.SHOULD)
+		/// <li>For BooleanClause(query, false, true) use BooleanClause(query, BooleanClause.Occur.MUST_NOT)
+		/// </ul>
+		/// </deprecated>
 		public BooleanClause(Query q, bool r, bool p)
 		{
+			// TODO: remove for Lucene 2.0
 			query = q;
 			required = r;
 			prohibited = p;
+			if (required)
+			{
+				if (prohibited)
+				{
+					// prohibited && required doesn't make sense, but we want the old behaviour:
+					occur = Occur.MUST_NOT;
+				}
+				else
+				{
+					occur = Occur.MUST;
+				}
+			}
+			else
+			{
+				if (prohibited)
+				{
+					occur = Occur.MUST_NOT;
+				}
+				else
+				{
+					occur = Occur.SHOULD;
+				}
+			}
+		}
+		
+		/// <summary>Constructs a BooleanClause.</summary>
+		public BooleanClause(Query query, Occur occur)
+		{
+			this.query = query;
+			this.occur = occur;
+			SetFields(occur);
+		}
+		
+		public virtual Occur GetOccur()
+		{
+			return occur;
+		}
+		
+		public virtual void  SetOccur(Occur occur)
+		{
+			this.occur = occur;
+			SetFields(occur);
+		}
+		
+		public virtual Query GetQuery()
+		{
+			return query;
+		}
+		
+		public virtual void  SetQuery(Query query)
+		{
+			this.query = query;
+		}
+		
+		public virtual bool IsProhibited()
+		{
+			return prohibited;
+		}
+		
+		public virtual bool IsRequired()
+		{
+			return required;
+		}
+		
+		private void  SetFields(Occur occur)
+		{
+			if (occur == Occur.MUST)
+			{
+				required = true;
+				prohibited = false;
+			}
+			else if (occur == Occur.SHOULD)
+			{
+				required = false;
+				prohibited = false;
+			}
+			else if (occur == Occur.MUST_NOT)
+			{
+				required = false;
+				prohibited = true;
+			}
+			else
+			{
+				throw new System.ArgumentException("Unknown operator " + occur);
+			}
 		}
 		
 		/// <summary>Returns true iff <code>o</code> is equal to this. </summary>
@@ -54,6 +193,12 @@
 		public override int GetHashCode()
 		{
 			return query.GetHashCode() ^ (this.required?1:0) ^ (this.prohibited?2:0);
+		}
+		
+		
+		public override System.String ToString()
+		{
+			return occur.ToString() + query.ToString();
 		}
 	}
 }



Mime
View raw message