mirror of https://github.com/apache/lucene.git
LUCENE-1912: fix issue when 2 or more terms are concatenated
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@816151 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
203925ad70
commit
dac29b3f49
|
@ -87,6 +87,9 @@ Bug fixes
|
|||
* 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)
|
||||
|
|
|
@ -146,10 +146,10 @@ public class FieldPhraseList {
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -76,6 +76,20 @@ public class FieldPhraseListTest extends AbstractTestCase {
|
|||
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" );
|
||||
|
||||
|
|
Loading…
Reference in New Issue