mirror of https://github.com/apache/lucene.git
LUCENE-2616: FastVectorHighlighter: out of alignment when the first value is empty in multiValued field
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@989035 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fcfa3ef727
commit
1238382bf4
|
@ -486,6 +486,9 @@ Bug fixes
|
|||
can cause the same document to score to differently depending on
|
||||
what segment it resides in. (yonik)
|
||||
|
||||
* LUCENE-2616: FastVectorHighlighter: out of alignment when the first value is
|
||||
empty in multiValued field (Koji Sekiguchi)
|
||||
|
||||
New features
|
||||
|
||||
* LUCENE-2128: Parallelized fetching document frequencies during weight
|
||||
|
|
|
@ -155,9 +155,10 @@ public abstract class BaseFragmentsBuilder implements FragmentsBuilder {
|
|||
protected String getFragmentSource( StringBuilder buffer, int[] index, String[] values,
|
||||
int startOffset, int endOffset ){
|
||||
while( buffer.length() < endOffset && index[0] < values.length ){
|
||||
if( index[0] > 0 && values[index[0]].length() > 0 )
|
||||
buffer.append( values[index[0]] );
|
||||
if( values[index[0]].length() > 0 && index[0] + 1 < values.length )
|
||||
buffer.append( multiValuedSeparator );
|
||||
buffer.append( values[index[0]++] );
|
||||
index[0]++;
|
||||
}
|
||||
int eo = buffer.length() < endOffset ? buffer.length() : endOffset;
|
||||
return buffer.substring( startOffset, eo );
|
||||
|
@ -166,9 +167,10 @@ public abstract class BaseFragmentsBuilder implements FragmentsBuilder {
|
|||
protected String getFragmentSource( StringBuilder buffer, int[] index, Field[] values,
|
||||
int startOffset, int endOffset ){
|
||||
while( buffer.length() < endOffset && index[0] < values.length ){
|
||||
if( index[0] > 0 && values[index[0]].isTokenized() && values[index[0]].stringValue().length() > 0 )
|
||||
buffer.append( values[index[0]].stringValue() );
|
||||
if( values[index[0]].isTokenized() && values[index[0]].stringValue().length() > 0 && index[0] + 1 < values.length )
|
||||
buffer.append( multiValuedSeparator );
|
||||
buffer.append( values[index[0]++].stringValue() );
|
||||
index[0]++;
|
||||
}
|
||||
int eo = buffer.length() < endOffset ? buffer.length() : endOffset;
|
||||
return buffer.substring( startOffset, eo );
|
||||
|
|
|
@ -60,6 +60,8 @@ public abstract class AbstractTestCase extends LuceneTestCase {
|
|||
protected QueryParser paB;
|
||||
|
||||
protected static final String[] shortMVValues = {
|
||||
"",
|
||||
"",
|
||||
"a b c",
|
||||
"", // empty data in multi valued field
|
||||
"d e"
|
||||
|
@ -352,6 +354,9 @@ public abstract class AbstractTestCase extends LuceneTestCase {
|
|||
}
|
||||
|
||||
protected void makeIndexShortMV() throws Exception {
|
||||
|
||||
// ""
|
||||
// ""
|
||||
|
||||
// 012345
|
||||
// "a b c"
|
||||
|
|
Loading…
Reference in New Issue