Return-Path: Delivered-To: apmail-lucene-java-dev-archive@www.apache.org Received: (qmail 72658 invoked from network); 29 Oct 2009 08:23:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 29 Oct 2009 08:23:23 -0000 Received: (qmail 52226 invoked by uid 500); 29 Oct 2009 08:23:23 -0000 Delivered-To: apmail-lucene-java-dev-archive@lucene.apache.org Received: (qmail 52162 invoked by uid 500); 29 Oct 2009 08:23:22 -0000 Mailing-List: contact java-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@lucene.apache.org Delivered-To: mailing list java-dev@lucene.apache.org Received: (qmail 52154 invoked by uid 99); 29 Oct 2009 08:23:22 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Oct 2009 08:23:22 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Oct 2009 08:23:20 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 73F40234C045 for ; Thu, 29 Oct 2009 01:22:59 -0700 (PDT) Message-ID: <272287911.1256804579459.JavaMail.jira@brutus> Date: Thu, 29 Oct 2009 08:22:59 +0000 (UTC) From: "Uwe Schindler (JIRA)" To: java-dev@lucene.apache.org Subject: [jira] Commented: (LUCENE-2014) position increment bug: smartcn In-Reply-To: <2135112232.1256803499476.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/LUCENE-2014?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12771327#action_12771327 ] Uwe Schindler commented on LUCENE-2014: --------------------------------------- I do not see the problem, from StopFilter: {code:java} @Override public final boolean incrementToken() throws IOException { // return the first non-stop word found int skippedPositions = 0; while (input.incrementToken()) { if (!stopWords.contains(termAtt.termBuffer(), 0, termAtt.termLength())) { if (enablePositionIncrements) { posIncrAtt.setPositionIncrement(posIncrAtt.getPositionIncrement() + skippedPositions); } return true; } skippedPositions += posIncrAtt.getPositionIncrement(); } // reached EOS -- return false return false; } {code} The problem can only be that the input filter returned some big posIncr for the stop word. The code seems very clear to me. Let's debug :-) > position increment bug: smartcn > ------------------------------- > > Key: LUCENE-2014 > URL: https://issues.apache.org/jira/browse/LUCENE-2014 > Project: Lucene - Java > Issue Type: Bug > Components: contrib/analyzers > Reporter: Robert Muir > Attachments: LUCENE-2014.patch > > > If i use LUCENE_VERSION >= 2.9 with smart chinese analyzer, it will crash indexwriter with any reasonable amount of chinese text. > its especially annoying because it happens in 2.9.1 RC as well. > this is because the position increments for tokens after stopwords are bogus: > Here's an example (from test case), where the position increment should be 2, but is instead 91975314! > {code} > public void testChineseStopWords2() throws Exception { > Analyzer ca = new SmartChineseAnalyzer(Version.LUCENE_CURRENT); /* will load stopwords */ > String sentence = "Title:San"; // : is a stopword > String result[] = { "titl", "san"}; > int startOffsets[] = { 0, 6 }; > int endOffsets[] = { 5, 9 }; > int posIncr[] = { 1, 2 }; > assertAnalyzesTo(ca, sentence, result, startOffsets, endOffsets, posIncr); > } > {code} > junit.framework.AssertionFailedError: posIncrement 1 expected:<2> but was:<91975314> > at junit.framework.Assert.fail(Assert.java:47) > at junit.framework.Assert.failNotEquals(Assert.java:280) > at junit.framework.Assert.assertEquals(Assert.java:64) > at junit.framework.Assert.assertEquals(Assert.java:198) > at org.apache.lucene.analysis.BaseTokenStreamTestCase.assertTokenStreamContents(BaseTokenStreamTestCase.java:83) > ... -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org For additional commands, e-mail: java-dev-help@lucene.apache.org