lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r1228705 - in /lucene/dev/branches/branch_3x: ./ lucene/ lucene/contrib/analyzers/ lucene/contrib/analyzers/common/src/test/org/apache/lucene/analysis/synonym/TestSynonymMapFilter.java lucene/contrib/icu/ solr/
Date Sat, 07 Jan 2012 19:37:07 GMT
Author: mikemccand
Date: Sat Jan  7 19:37:07 2012
New Revision: 1228705

URL: http://svn.apache.org/viewvc?rev=1228705&view=rev
Log:
fix syn test bug

Modified:
    lucene/dev/branches/branch_3x/   (props changed)
    lucene/dev/branches/branch_3x/lucene/   (props changed)
    lucene/dev/branches/branch_3x/lucene/contrib/analyzers/   (props changed)
    lucene/dev/branches/branch_3x/lucene/contrib/analyzers/common/src/test/org/apache/lucene/analysis/synonym/TestSynonymMapFilter.java
    lucene/dev/branches/branch_3x/lucene/contrib/icu/   (props changed)
    lucene/dev/branches/branch_3x/solr/   (props changed)

Modified: lucene/dev/branches/branch_3x/lucene/contrib/analyzers/common/src/test/org/apache/lucene/analysis/synonym/TestSynonymMapFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/contrib/analyzers/common/src/test/org/apache/lucene/analysis/synonym/TestSynonymMapFilter.java?rev=1228705&r1=1228704&r2=1228705&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/contrib/analyzers/common/src/test/org/apache/lucene/analysis/synonym/TestSynonymMapFilter.java
(original)
+++ lucene/dev/branches/branch_3x/lucene/contrib/analyzers/common/src/test/org/apache/lucene/analysis/synonym/TestSynonymMapFilter.java
Sat Jan  7 19:37:07 2012
@@ -261,9 +261,16 @@ public class TestSynonymMapFilter extend
           } else {
             outputs[matchIDX] = outputs[matchIDX] + "/" + synOutputs[synUpto++];
           }
-          if (synOutputs.length == 1) {
-            // Add endOffset
-            outputs[matchIDX] = outputs[matchIDX] + ":" + ((inputIDX*2) + syn.in.length());
+          final int endOffset;
+          if (matchIDX < numInputs) {
+            if (synOutputs.length == 1) {
+              // Add full endOffset
+              endOffset = (inputIDX*2) + syn.in.length();
+            } else {
+              // Add endOffset matching input token's
+              endOffset = (matchIDX*2) + 1;
+            }
+            outputs[matchIDX] = outputs[matchIDX] + ":" + endOffset;
           }
         }
       }



Mime
View raw message