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:
Michael McCandless 2009-09-17 11:41:30 +00:00
parent 203925ad70
commit dac29b3f49
3 changed files with 21 additions and 4 deletions

View File

@ -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)

View File

@ -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;
}

View File

@ -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" );