jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r631539 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CaseTermQuery.java
Date Wed, 27 Feb 2008 10:22:18 GMT
Author: mreutegg
Date: Wed Feb 27 02:22:16 2008
New Revision: 631539

URL: http://svn.apache.org/viewvc?rev=631539&view=rev
Log:
JCR-1425: [PATCH] reduce duplicate conversions from OffsetCharSequence to (lower/upper) strings

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CaseTermQuery.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CaseTermQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CaseTermQuery.java?rev=631539&r1=631538&r2=631539&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CaseTermQuery.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CaseTermQuery.java
Wed Feb 27 02:22:16 2008
@@ -98,19 +98,23 @@
                 if (term.text().length() > nameLength) {
                     // start with initial lower case
                     StringBuffer lowerLimit = new StringBuffer(propName);
-                    lowerLimit.append(termText.toString().toUpperCase());
+                    String termStr = termText.toString();
+                    String upperTermStr = termStr.toUpperCase();
+                    String lowerTermStr = termStr.toLowerCase();
+                    
+                    lowerLimit.append(upperTermStr);
                     lowerLimit.setCharAt(nameLength, Character.toLowerCase(lowerLimit.charAt(nameLength)));
                     StringBuffer upperLimit = new StringBuffer(propName);
-                    upperLimit.append(termText.toString().toLowerCase());
+                    upperLimit.append(lowerTermStr);
                     rangeScans.add(new RangeScan(reader,
                             new Term(term.field(), lowerLimit.toString()),
                             new Term(term.field(), upperLimit.toString())));
 
                     // second scan with upper case start
                     lowerLimit = new StringBuffer(propName);
-                    lowerLimit.append(termText.toString().toUpperCase());
+                    lowerLimit.append(upperTermStr);
                     upperLimit = new StringBuffer(propName);
-                    upperLimit.append(termText.toString().toLowerCase());
+                    upperLimit.append(lowerTermStr);
                     upperLimit.setCharAt(nameLength, Character.toUpperCase(upperLimit.charAt(nameLength)));
                     rangeScans.add(new RangeScan(reader,
                             new Term(term.field(), lowerLimit.toString()),



Mime
View raw message