[
https://issues.apache.org/jira/browse/LUCENE-4072?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13856149#comment-13856149
]
Robert Muir commented on LUCENE-4072:
-------------------------------------
One thing that certainly looks like a bug is this:
The input-processing side looks like this in pseudocode:
{code}
while (read() some char[]s) {
normalize(char[]s) // (quick check/hasBoundary/etc)
}
{code}
But read() works at char level, and these normalization apis want ints.
So I think readInputToBuffer() needs to keep reading, if possible, to ensure it
fully consumes whole codepoints before returning. I added a little hack
locally, but it didnt seem to clean up the test fails, so I think there are
other bugs too, or I'm missing something?
{code}
private int readInputToBuffer() throws IOException {
final int len = input.read(tmpBuffer);
if (len == -1) {
inputFinished = true;
return 0;
}
inputBuffer.append(tmpBuffer, 0, len);
// nocommit: just a hack
// if buffer ends on high surrogate, keep reading before processing
if (len > 0 && Character.isHighSurrogate(tmpBuffer[len-1])) {
return len + readInputToBuffer();
}
// end hack
return len;
}
{code}
> CharFilter that Unicode-normalizes input
> ----------------------------------------
>
> Key: LUCENE-4072
> URL: https://issues.apache.org/jira/browse/LUCENE-4072
> Project: Lucene - Core
> Issue Type: New Feature
> Components: modules/analysis
> Reporter: Ippei UKAI
> Attachments: DebugCode.txt, LUCENE-4072.patch, LUCENE-4072.patch,
> LUCENE-4072.patch, LUCENE-4072.patch, LUCENE-4072.patch, LUCENE-4072.patch,
> ippeiukai-ICUNormalizer2CharFilter-4752cad.zip
>
>
> I'd like to contribute a CharFilter that Unicode-normalizes input with ICU4J.
> The benefit of having this process as CharFilter is that tokenizer can work
> on normalised text while offset-correction ensuring fast vector highlighter
> and other offset-dependent features do not break.
> The implementation is available at following repository:
> https://github.com/ippeiukai/ICUNormalizer2CharFilter
> Unfortunately this is my unpaid side-project and cannot spend much time to
> merge my work to Lucene to make appropriate patch. I'd appreciate it if
> anyone could give it a go. I'm happy to relicense it to whatever that meets
> your needs.
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]