lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mharw...@apache.org
Subject svn commit: r208682 - /lucene/java/trunk/src/java/org/apache/lucene/index/Term.java
Date Thu, 30 Jun 2005 20:57:21 GMT
Author: mharwood
Date: Thu Jun 30 13:57:18 2005
New Revision: 208682

URL: http://svn.apache.org/viewcvs?rev=208682&view=rev
Log:
added createTerm method to create Terms without incurring fieldName.intern() overhead

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/index/Term.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/Term.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/index/Term.java?rev=208682&r1=208681&r2=208682&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/Term.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/Term.java Thu Jun 30 13:57:18 2005
@@ -45,6 +45,17 @@
     text of the word.  In the case of dates and other types, this is an
     encoding of the object as a string.  */
   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
       field and text. */



Mime
View raw message