[
https://issues.apache.org/jira/browse/LUCENE-5444?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13901188#comment-13901188
]
Simon Willnauer commented on LUCENE-5444:
-----------------------------------------
Hey Britta, thanks for opening this issue! I actually think the patch looks
pretty good though. Could you move the testcase into _MemoryIndexTest_ instead?
We usually use a utility method to create a new directory & index writers in
tests like this:
{noformat}
Directory dir = newDirectory();
MockAnalyzer mockAnalyzer = new MockAnalyzer(random());
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(random(),
TEST_VERSION_CURRENT, mockAnalyzer));
{noformat}
I also think from looking at it the test must fail since you are not closing
the index writer, index reader and the directory. I guess you should move most
of it into a single method and only keep the _compareTermVectors_ in a sep.
method. Additionally I think since your patch allows it we should also test the
`offsetGap` could you add another test for this as well? If you do so feel free
to add a _getOffsetGap(String)_ method to _MockAnalyzer_ so you can reuse your
tests!
> offsets in MemoryIndex broken when adding field with more than once
> -------------------------------------------------------------------
>
> Key: LUCENE-5444
> URL: https://issues.apache.org/jira/browse/LUCENE-5444
> Project: Lucene - Core
> Issue Type: Bug
> Components: core/index
> Affects Versions: 4.6.1
> Reporter: britta weber
> Labels: easyfix
> Fix For: 5.0, 4.7
>
> Attachments: LUCENE-5444.patch
>
> Original Estimate: 168h
> Remaining Estimate: 168h
>
> When fields with the same name are added more than once to MemoryIndex, the
> offsets of the previous additions of the field do not seem to be taken into
> account. As a result, MemoryIndex cannot be used for example with the vector
> highlighter.
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]