mirror of https://github.com/apache/lucene.git
added createTerm method to create Terms without incurring fieldName.intern() overhead
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@208682 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7894a0c0c0
commit
fa211e79d6
|
@ -46,6 +46,17 @@ public final class Term implements Comparable, java.io.Serializable {
|
||||||
encoding of the object as a string. */
|
encoding of the object as a string. */
|
||||||
public final String text() { return text; }
|
public final String text() { return text; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Optimized construction of new Terms by reusing same field as this Term
|
||||||
|
* - avoids field.intern() overhead
|
||||||
|
* @param text The text of the new term (field is implicitly same as this Term instance)
|
||||||
|
* @return A new Term
|
||||||
|
*/
|
||||||
|
public Term createTerm(String text)
|
||||||
|
{
|
||||||
|
return new Term(field,text,false);
|
||||||
|
}
|
||||||
|
|
||||||
/** Compares two terms, returning true iff they have the same
|
/** Compares two terms, returning true iff they have the same
|
||||||
field and text. */
|
field and text. */
|
||||||
public final boolean equals(Object o) {
|
public final boolean equals(Object o) {
|
||||||
|
|
Loading…
Reference in New Issue