mirror of https://github.com/apache/lucene.git
LUCENE-3698: FVH adds a multi value separator to the end of the highlighted text
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1232470 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3e4fc88708
commit
1b82292e02
|
@ -106,6 +106,11 @@ Changes in backwards compatibility policy
|
|||
and MultiPassIndexSplitter were made private as they now work
|
||||
per segment. (Uwe Schindler)
|
||||
|
||||
Changes in Runtime Behavior
|
||||
|
||||
* LUCENE-3698: FastVectorHighlighter no longer adds a multi value separator
|
||||
to the end of the highlighted text. (Shay Banon via Koji Sekiguchi)
|
||||
|
||||
New Features
|
||||
|
||||
* LUCENE-3596: DirectoryTaxonomyWriter extensions can override createIndexWriterConfig()
|
||||
|
|
|
@ -166,7 +166,12 @@ public abstract class BaseFragmentsBuilder implements FragmentsBuilder {
|
|||
buffer.append( values[index[0]++].stringValue() );
|
||||
buffer.append( getMultiValuedSeparator() );
|
||||
}
|
||||
int eo = buffer.length() < endOffset ? buffer.length() : boundaryScanner.findEndOffset( buffer, endOffset );
|
||||
int bufferLength = buffer.length();
|
||||
// we added the multi value char to the last buffer, ignore it
|
||||
if (values[index[0] - 1].fieldType().tokenized()) {
|
||||
bufferLength--;
|
||||
}
|
||||
int eo = bufferLength < endOffset ? bufferLength : boundaryScanner.findEndOffset( buffer, endOffset );
|
||||
modifiedStartOffset[0] = boundaryScanner.findStartOffset( buffer, startOffset );
|
||||
return buffer.substring( modifiedStartOffset[0], eo );
|
||||
}
|
||||
|
|
|
@ -160,7 +160,7 @@ public class SimpleFragmentsBuilderTest extends AbstractTestCase {
|
|||
FieldFragList ffl = sflb.createFieldFragList( fpl, 100 );
|
||||
SimpleFragmentsBuilder sfb = new SimpleFragmentsBuilder();
|
||||
sfb.setMultiValuedSeparator( '/' );
|
||||
assertEquals( "abc/<b>defg</b>/hijkl/", sfb.createFragment( reader, 0, F, ffl ) );
|
||||
assertEquals( "abc/<b>defg</b>/hijkl", sfb.createFragment( reader, 0, F, ffl ) );
|
||||
}
|
||||
|
||||
public void testMVSeparator() throws Exception {
|
||||
|
@ -173,6 +173,6 @@ public class SimpleFragmentsBuilderTest extends AbstractTestCase {
|
|||
FieldFragList ffl = sflb.createFieldFragList( fpl, 100 );
|
||||
SimpleFragmentsBuilder sfb = new SimpleFragmentsBuilder();
|
||||
sfb.setMultiValuedSeparator( '/' );
|
||||
assertEquals( " b c//<b>d</b> e/", sfb.createFragment( reader, 0, F, ffl ) );
|
||||
assertEquals( " b c//<b>d</b> e", sfb.createFragment( reader, 0, F, ffl ) );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue