lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r816151 - in /lucene/java/trunk/contrib: ./ fast-vector-highlighter/src/java/org/apache/lucene/search/vectorhighlight/ fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/
Date Thu, 17 Sep 2009 11:41:30 GMT
Author: mikemccand
Date: Thu Sep 17 11:41:30 2009
New Revision: 816151

URL: http://svn.apache.org/viewvc?rev=816151&view=rev
Log:
LUCENE-1912: fix issue when 2 or more terms are concatenated

Modified:
    lucene/java/trunk/contrib/CHANGES.txt
    lucene/java/trunk/contrib/fast-vector-highlighter/src/java/org/apache/lucene/search/vectorhighlight/FieldPhraseList.java
    lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/FieldPhraseListTest.java

Modified: lucene/java/trunk/contrib/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/CHANGES.txt?rev=816151&r1=816150&r2=816151&view=diff
==============================================================================
--- lucene/java/trunk/contrib/CHANGES.txt (original)
+++ lucene/java/trunk/contrib/CHANGES.txt Thu Sep 17 11:41:30 2009
@@ -87,6 +87,9 @@
  * LUCENE-1828: Fix memory index to call TokenStream.reset() and
     TokenStream.end(). (Tim Smith via Michael Busch)
 
+ * LUCENE-1912: Fix fast-vector-highlighter issue when two or more
+   terms are concatenated (Koji Sekiguchi via Mike McCandless)
+
 New features
 
  * LUCENE-1531: Added support for BoostingTermQuery to XML query parser. (Karl Wettin)

Modified: lucene/java/trunk/contrib/fast-vector-highlighter/src/java/org/apache/lucene/search/vectorhighlight/FieldPhraseList.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/fast-vector-highlighter/src/java/org/apache/lucene/search/vectorhighlight/FieldPhraseList.java?rev=816151&r1=816150&r2=816151&view=diff
==============================================================================
--- lucene/java/trunk/contrib/fast-vector-highlighter/src/java/org/apache/lucene/search/vectorhighlight/FieldPhraseList.java
(original)
+++ lucene/java/trunk/contrib/fast-vector-highlighter/src/java/org/apache/lucene/search/vectorhighlight/FieldPhraseList.java
Thu Sep 17 11:41:30 2009
@@ -146,10 +146,10 @@
       int eo = getEndOffset();
       int oso = other.getStartOffset();
       int oeo = other.getEndOffset();
-      if( so <= oso && oso <= eo ) return true;
-      if( so <= oeo && oeo <= eo ) return true;
-      if( oso <= so && so <= oeo ) return true;
-      if( oso <= eo && eo <= oeo ) return true;
+      if( so <= oso && oso < eo ) return true;
+      if( so < oeo && oeo <= eo ) return true;
+      if( oso <= so && so < oeo ) return true;
+      if( oso < eo && eo <= oeo ) return true;
       return false;
     }
     

Modified: lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/FieldPhraseListTest.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/FieldPhraseListTest.java?rev=816151&r1=816150&r2=816151&view=diff
==============================================================================
--- lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/FieldPhraseListTest.java
(original)
+++ lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/FieldPhraseListTest.java
Thu Sep 17 11:41:30 2009
@@ -76,6 +76,20 @@
     assertEquals( "baac(1.0)((2,5))", fpl.phraseList.get( 0 ).toString() );
   }
   
+  public void test2ConcatTermsIndexB() throws Exception {
+    // 01 12 23 (offsets)
+    // ab|ba|ab
+    //  0  1  2 (positions)
+    make1d1fIndexB( "abab" );
+
+    FieldQuery fq = new FieldQuery( tq( "ab" ), true, true );
+    FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+    FieldPhraseList fpl = new FieldPhraseList( stack, fq );
+    assertEquals( 2, fpl.phraseList.size() );
+    assertEquals( "ab(1.0)((0,2))", fpl.phraseList.get( 0 ).toString() );
+    assertEquals( "ab(1.0)((2,4))", fpl.phraseList.get( 1 ).toString() );
+  }
+  
   public void test2Terms1PhraseIndex() throws Exception {
     make1d1fIndex( "c a a b" );
 



Mime
View raw message