lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pnas...@apache.org
Subject [Lucene.Net] svn commit: r1100452 - in /incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core: ./ Search/Regex/
Date Sat, 07 May 2011 05:28:26 GMT
Author: pnasser
Date: Sat May  7 05:28:26 2011
New Revision: 1100452

URL: http://svn.apache.org/viewvc?rev=1100452&view=rev
Log:
LUCENENET-330 Search.Regex minimal port

Added:
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Regex/
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Regex/CSharpRegexCapabilities.cs
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Regex/IRegexCapabilities.cs
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Regex/IRegexQueryCapable.cs
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Regex/RegexQuery.cs
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Regex/RegexTermEnum.cs
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Regex/SpanRegexQuery.cs
Modified:
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Lucene.Net.csproj

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Lucene.Net.csproj
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Lucene.Net.csproj?rev=1100452&r1=1100451&r2=1100452&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Lucene.Net.csproj (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Lucene.Net.csproj Sat May  7
05:28:26 2011
@@ -527,6 +527,7 @@
     <Compile Include="Search\ConstantScoreRangeQuery.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="Search\Regex\CSharpRegexCapabilities.cs" />
     <Compile Include="Search\DefaultSimilarity.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -619,6 +620,8 @@
     <Compile Include="Search\IndexSearcher.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="Search\Regex\IRegexCapabilities.cs" />
+    <Compile Include="Search\Regex\IRegexQueryCapable.cs" />
     <Compile Include="Search\MatchAllDocsQuery.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -681,6 +684,8 @@
     <Compile Include="Search\RangeQuery.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="Search\Regex\RegexQuery.cs" />
+    <Compile Include="Search\Regex\RegexTermEnum.cs" />
     <Compile Include="Search\ReqExclScorer.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -727,6 +732,7 @@
     <Compile Include="Search\SpanFilter.cs" />
     <Compile Include="Search\SpanFilterResult.cs" />
     <Compile Include="Search\SpanQueryFilter.cs" />
+    <Compile Include="Search\Regex\SpanRegexQuery.cs" />
     <Compile Include="Search\Spans\FieldMaskingSpanQuery.cs" />
     <Compile Include="Search\Spans\NearSpansOrdered.cs">
       <SubType>Code</SubType>

Added: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Regex/CSharpRegexCapabilities.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Regex/CSharpRegexCapabilities.cs?rev=1100452&view=auto
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Regex/CSharpRegexCapabilities.cs
(added)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Regex/CSharpRegexCapabilities.cs
Sat May  7 05:28:26 2011
@@ -0,0 +1,91 @@
+/* 
+ * 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.
+ */
+
+using System;
+
+namespace Lucene.Net.Search.Regex
+{
+	/// <summary>
+	/// C# Regex based implementation of <see cref="IRegexCapabilities"/>.
+	/// </summary>
+	/// <remarks>http://www.java2s.com/Open-Source/Java-Document/Net/lucene-connector/org/apache/lucene/search/regex/JavaUtilRegexCapabilities.java.htm</remarks>
+	public class CSharpRegexCapabilities : IRegexCapabilities, IEquatable<CSharpRegexCapabilities>
+	{
+		private System.Text.RegularExpressions.Regex _rPattern;
+
+		/// <summary>
+		/// Called by the constructor of <see cref="RegexTermEnum"/> allowing implementations
to cache 
+		/// a compiled version of the regular expression pattern.
+		/// </summary>
+		/// <param name="pattern">regular expression pattern</param>
+		public void Compile(string pattern)
+		{
+			_rPattern = new System.Text.RegularExpressions.Regex(pattern, 
+				System.Text.RegularExpressions.RegexOptions.Compiled);
+		}
+
+		/// <summary>
+		/// True on match.
+		/// </summary>
+		/// <param name="s">text to match</param>
+		/// <returns>true on match</returns>
+		public bool Match(string s)
+		{
+			return _rPattern.IsMatch(s);
+		}
+
+		/// <summary>
+		/// A wise prefix implementation can reduce the term enumeration (and thus performance)
+		/// of RegexQuery dramatically.
+		/// </summary>
+		/// <returns>static non-regex prefix of the pattern last passed to <see cref="IRegexCapabilities.Compile"/>.
+		///   May return null</returns>
+		public string Prefix()
+		{
+			return null;
+		}
+
+		/// <summary>
+		/// Indicates whether the current object is equal to another object of the same type.
+		/// </summary>
+		/// <returns>
+		/// true if the current object is equal to the <paramref name="other"/> parameter;
otherwise, false.
+		/// </returns>
+		/// <param name="other">An object to compare with this object</param>
+		public bool Equals(CSharpRegexCapabilities other)
+		{
+			if (other == null) return false;
+			if (this == other) return true;
+
+			if (_rPattern != null ? !_rPattern.Equals(other._rPattern) : other._rPattern != null)
+				return false;
+
+			return true;
+		}
+
+		public override bool Equals(object obj)
+		{
+			if (obj as CSharpRegexCapabilities == null) return false;
+			return Equals((CSharpRegexCapabilities) obj);
+		}
+
+		public override int GetHashCode()
+		{
+			return (_rPattern != null ? _rPattern.GetHashCode() : 0);
+		}
+	}
+}

Added: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Regex/IRegexCapabilities.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Regex/IRegexCapabilities.cs?rev=1100452&view=auto
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Regex/IRegexCapabilities.cs
(added)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Regex/IRegexCapabilities.cs
Sat May  7 05:28:26 2011
@@ -0,0 +1,48 @@
+/* 
+ * 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.
+ */
+
+namespace Lucene.Net.Search.Regex
+{
+	/// <summary>
+	/// Defines basic operations needed by {@link RegexQuery} for a regular expression implementation.
+	/// </summary>
+	/// <remarks>http://www.java2s.com/Open-Source/Java-Document/Net/lucene-connector/org/apache/lucene/search/regex/RegexCapabilities.java.htm</remarks>
+	public interface IRegexCapabilities
+	{
+		/// <summary>
+		/// Called by the constructor of <see cref="RegexTermEnum"/> allowing implementations
to cache 
+		/// a compiled version of the regular expression pattern.
+		/// </summary>
+		/// <param name="pattern">regular expression pattern</param>
+		void Compile(string pattern);
+
+		/// <summary>
+		/// True on match.
+		/// </summary>
+		/// <param name="s">text to match</param>
+		/// <returns>true on match</returns>
+		bool Match(string s);
+
+		/// <summary>
+		/// A wise prefix implementation can reduce the term enumeration (and thus performance)
+		/// of RegexQuery dramatically.
+		/// </summary>
+		/// <returns>static non-regex prefix of the pattern last passed to <see cref="Compile"/>.
+		///   May return null</returns>
+		string Prefix();
+	}
+}

Added: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Regex/IRegexQueryCapable.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Regex/IRegexQueryCapable.cs?rev=1100452&view=auto
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Regex/IRegexQueryCapable.cs
(added)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Regex/IRegexQueryCapable.cs
Sat May  7 05:28:26 2011
@@ -0,0 +1,29 @@
+/* 
+ * 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.
+ */
+
+namespace Lucene.Net.Search.Regex
+{
+	/// <summary>
+	/// Defines methods for regular expression supporting queries to use.
+	/// </summary>
+	/// <remarks>http://www.java2s.com/Open-Source/Java-Document/Net/lucene-connector/org/apache/lucene/search/regex/RegexQueryCapable.java.htm</remarks>
+	public interface IRegexQueryCapable
+	{
+		void SetRegexImplementation(IRegexCapabilities impl);
+		IRegexCapabilities GetRegexImplementation();
+	}
+}

Added: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Regex/RegexQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Regex/RegexQuery.cs?rev=1100452&view=auto
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Regex/RegexQuery.cs (added)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Regex/RegexQuery.cs Sat
May  7 05:28:26 2011
@@ -0,0 +1,81 @@
+/* 
+ * 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.
+ */
+
+using System;
+using Lucene.Net.Index;
+
+namespace Lucene.Net.Search.Regex
+{
+	/// <summary>
+	/// Regular expression based query.
+	/// </summary>
+	/// <remarks>http://www.java2s.com/Open-Source/Java-Document/Net/lucene-connector/org/apache/lucene/search/regex/RegexQuery.java.htm</remarks>
+	public class RegexQuery : MultiTermQuery, IRegexQueryCapable, IEquatable<RegexQuery>
+	{
+		private IRegexCapabilities _regexImpl = new CSharpRegexCapabilities();
+
+		public RegexQuery(Term term) : base(term)
+		{
+		}
+
+		/// <summary>Construct the enumeration to be used, expanding the pattern term. </summary>
+		public override FilteredTermEnum GetEnum(IndexReader reader)
+		{
+			Term term = new Term(GetTerm().Field(), GetTerm().Text());
+			return new RegexTermEnum(reader, term, _regexImpl);
+		}
+
+		public void SetRegexImplementation(IRegexCapabilities impl)
+		{
+			_regexImpl = impl;
+		}
+
+		public IRegexCapabilities GetRegexImplementation()
+		{
+			return _regexImpl;
+		}
+
+		/// <summary>
+		/// Indicates whether the current object is equal to another object of the same type.
+		/// </summary>
+		/// <returns>
+		/// true if the current object is equal to the <paramref name="other"/> parameter;
otherwise, false.
+		/// </returns>
+		/// <param name="other">An object to compare with this object</param>
+		public bool Equals(RegexQuery other)
+		{
+			if (other == null) return false;
+			if (this == other) return true;
+
+			if (!base.Equals(other)) return false;
+			return _regexImpl.Equals(other._regexImpl);
+		}
+
+		public override bool Equals(object obj)
+		{
+			if ((obj == null) || (obj as RegexQuery == null)) return false;
+			if (this == obj) return true;
+
+			return Equals((RegexQuery) obj);
+		}
+
+		public override int GetHashCode()
+		{
+			return 29 * base.GetHashCode() + _regexImpl.GetHashCode();
+		}
+	}
+}

Added: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Regex/RegexTermEnum.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Regex/RegexTermEnum.cs?rev=1100452&view=auto
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Regex/RegexTermEnum.cs
(added)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Regex/RegexTermEnum.cs
Sat May  7 05:28:26 2011
@@ -0,0 +1,83 @@
+/* 
+ * 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.
+ */
+
+using Lucene.Net.Index;
+
+namespace Lucene.Net.Search.Regex
+{
+	/// <summary>
+	/// Subclass of FilteredTermEnum for enumerating all terms that match the
+	/// specified regular expression term using the specified regular expression
+	/// implementation.
+	/// <para>Term enumerations are always ordered by Term.compareTo().  Each term in
+	/// the enumeration is greater than all that precede it.</para>
+	/// </summary>
+	/// <remarks>http://www.java2s.com/Open-Source/Java-Document/Net/lucene-connector/org/apache/lucene/search/regex/RegexTermEnum.java.htm</remarks>
+	public class RegexTermEnum : FilteredTermEnum
+	{
+		private string _sField = "";
+		private string _sPre = "";
+		private bool _bEndEnum;
+		private readonly IRegexCapabilities _regexImpl;
+
+		public RegexTermEnum(IndexReader reader, Term term, IRegexCapabilities regexImpl)
+		{
+			_sField = term.Field();
+			string sText = term.Text();
+			
+			_regexImpl = regexImpl;
+
+			_regexImpl.Compile(sText);
+
+			_sPre = _regexImpl.Prefix() ?? "";
+
+			SetEnum(reader.Terms(new Term(term.Field(), _sPre)));
+		}
+
+		/// <summary>Equality compare on the term </summary>
+		public override bool TermCompare(Term term)
+		{
+			if (_sField == term.Field())
+			{
+				string sSearchText = term.Text();
+				if (sSearchText.StartsWith(_sPre)) return _regexImpl.Match(sSearchText);
+			} //eif
+
+			_bEndEnum = true;
+			return false;
+		}
+
+		/// <summary>Equality measure on the term </summary>
+		public override float Difference()
+		{
+			// TODO: adjust difference based on distance of searchTerm.text() and term().text()
+			return 1.0F;
+		}
+
+		/// <summary>Indicates the end of the enumeration has been reached </summary>
+		public override bool EndEnum()
+		{
+			return _bEndEnum;
+		}
+
+		//public override void Close()
+		//{
+		//    base.Close();
+		//    _sField = null;
+		//}
+	}
+}

Added: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Regex/SpanRegexQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Regex/SpanRegexQuery.cs?rev=1100452&view=auto
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Regex/SpanRegexQuery.cs
(added)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Regex/SpanRegexQuery.cs
Sat May  7 05:28:26 2011
@@ -0,0 +1,161 @@
+/* 
+ * 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.
+ */
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Text;
+using Lucene.Net.Index;
+using Lucene.Net.Search.Spans;
+using Lucene.Net.Util;
+
+namespace Lucene.Net.Search.Regex
+{
+	/// <summary>
+	/// A SpanQuery version of <see cref="RegexQuery"/> allowing regular expression queries
to be nested
+	/// within other SpanQuery subclasses.
+	/// </summary>
+	/// <remarks>http://www.java2s.com/Open-Source/Java-Document/Net/lucene-connector/org/apache/lucene/search/regex/SpanRegexQuery.java.htm</remarks>
+	public class SpanRegexQuery : SpanQuery, IRegexQueryCapable, IEquatable<SpanRegexQuery>
+	{
+		private IRegexCapabilities _regexImpl = new CSharpRegexCapabilities();
+		private readonly Term _term;
+
+		public SpanRegexQuery(Term term)
+		{
+			_term = term;
+		}
+
+		public Term GetTerm()
+		{
+			return _term;
+		}
+
+		public override string ToString(string field)
+		{
+			StringBuilder sb = new StringBuilder();
+			sb.Append("SpanRegexQuery(");
+			sb.Append(_term);
+			sb.Append(')');
+			sb.Append(ToStringUtils.Boost(GetBoost()));
+			return sb.ToString();
+		}
+
+		public override Query Rewrite(IndexReader reader)
+		{
+			RegexQuery orig = new RegexQuery(_term);
+			orig.SetRegexImplementation(_regexImpl);
+
+			// RegexQuery (via MultiTermQuery).Rewrite always returns a BooleanQuery
+			orig.SetRewriteMethod(MultiTermQuery.SCORING_BOOLEAN_QUERY_REWRITE);	//@@
+			BooleanQuery bq = (BooleanQuery) orig.Rewrite(reader);
+
+			BooleanClause[] clauses = bq.GetClauses();
+			SpanQuery[] sqs = new SpanQuery[clauses.Length];
+			for (int i = 0; i < clauses.Length; i++)
+			{
+				BooleanClause clause = clauses[i];
+
+				// Clauses from RegexQuery.Rewrite are always TermQuery's
+				TermQuery tq = (TermQuery) clause.GetQuery();
+
+				sqs[i] = new SpanTermQuery(tq.GetTerm());
+				sqs[i].SetBoost(tq.GetBoost());
+			} //efor
+
+			SpanOrQuery query = new SpanOrQuery(sqs);
+			query.SetBoost(orig.GetBoost());
+
+			return query;
+		}
+
+		/// <summary>Expert: Returns the matches for this query in an index.  Used internally
+		/// to search for spans. 
+		/// </summary>
+		public override Spans.Spans GetSpans(IndexReader reader)
+		{
+			throw new InvalidOperationException("Query should have been rewritten");
+		}
+
+		/// <summary>Returns the name of the field matched by this query.</summary>
+		public override string GetField()
+		{
+			return _term.Field();
+		}
+
+		/// <summary>Returns a collection of all terms matched by this query.</summary>
+		/// <deprecated> use extractTerms instead
+		/// </deprecated>
+		/// <seealso cref="Query.ExtractTerms">
+		/// </seealso>
+		public override IList<Term> GetTerms()
+		{
+			IList<Term> terms = new List<Term> {_term};
+		    return terms;
+		}
+    
+		public void SetRegexImplementation(IRegexCapabilities impl)
+		{
+			_regexImpl = impl;
+		}
+
+		public IRegexCapabilities GetRegexImplementation()
+		{
+			return _regexImpl;
+		}
+
+		/// <summary>
+		/// Indicates whether the current object is equal to another object of the same type.
+		/// </summary>
+		/// <returns>
+		/// true if the current object is equal to the <paramref name="other"/> parameter;
otherwise, false.
+		/// </returns>
+		/// <param name="other">An object to compare with this object.
+		///                 </param>
+		public bool Equals(SpanRegexQuery other)
+		{
+			if (other == null) return false;
+			if (this == other) return true;
+
+			if (!_regexImpl.Equals(other._regexImpl)) return false;
+			if (!_term.Equals(other._term)) return false;
+
+			return true;
+		}
+
+		/// <summary>
+		/// True if this object equals the specified object.
+		/// </summary>
+		/// <param name="obj">object</param>
+		/// <returns>true on equality</returns>
+		public override bool Equals(object obj)
+		{
+			if (obj as SpanRegexQuery == null) return false;
+
+			return Equals((SpanRegexQuery) obj);
+		}
+
+		/// <summary>
+		/// Get hash code for this object.
+		/// </summary>
+		/// <returns>hash code</returns>
+		public override int GetHashCode()
+		{
+			return 29 * _regexImpl.GetHashCode() + _term.GetHashCode();
+		}
+	}
+}



Mime
View raw message