22 namespace Lucene.Net.Index
32 public sealed
class Term : System.IComparable<Term>
34 internal System.String field;
35 internal System.String text;
41 public Term(System.String fld, System.String txt)
54 public Term(System.String fld):this(fld,
"", true)
58 internal Term(System.String fld, System.String txt,
bool intern)
88 public Term CreateTerm(System.String text)
90 return new Term(field, text,
false);
94 public override bool Equals(System.Object obj)
100 if (GetType() != obj.GetType())
105 if (other.field != null)
108 else if (!field.Equals(other.field))
112 if (other.text != null)
115 else if (!text.Equals(other.text))
121 public override int GetHashCode()
125 result = prime*result + ((field == null) ? 0 : field.GetHashCode());
126 result = prime*result + ((text == null) ? 0 : text.GetHashCode());
135 public int CompareTo(
Term other)
137 if ((System.Object) field == (System.Object) other.field)
139 return String.CompareOrdinal(text, other.text);
141 return String.CompareOrdinal(field, other.field);
151 public override System.String ToString()
153 return field +
":" + text;
162 [System.Runtime.Serialization.OnDeserialized]
163 internal void OnDeserialized(System.Runtime.Serialization.StreamingContext context)