Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 72012 invoked from network); 11 Jan 2010 06:50:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 11 Jan 2010 06:50:53 -0000 Received: (qmail 43526 invoked by uid 500); 11 Jan 2010 06:50:51 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 43438 invoked by uid 500); 11 Jan 2010 06:50:51 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 43428 invoked by uid 99); 11 Jan 2010 06:50:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Jan 2010 06:50:51 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Jan 2010 06:50:41 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1NUE6W-00026G-Em for java-user@lucene.apache.org; Sun, 10 Jan 2010 22:50:20 -0800 Message-ID: <27106452.post@talk.nabble.com> Date: Sun, 10 Jan 2010 22:50:20 -0800 (PST) From: Mohsen Saboorian To: java-user@lucene.apache.org Subject: Re: Highlighter doesn't highlight wildcard queries after updating to 2.9.1/3.0.0 In-Reply-To: <26969989.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: mohsens@gmail.com References: <26969517.post@talk.nabble.com> <4B3B84C0.3040001@gmail.com> <26969989.post@talk.nabble.com> X-Virus-Checked: Checked by ClamAV on apache.org The problem comes from this method: org.apache.lucene.search.highlight.WeightedSpanTermExtractor.extract(Query, Map) The query passed to this method is of type org.apache.lucene.search.ConstantScoreQuery, but it matches non of 'instanceof' checkings in this method, so no WeightedSpanTerm is extracted. It this a bug? Thanks, Mohsen Mohsen Saboorian wrote: > > Yes I can (though I need some time, since I have my nested custom > analyzers and filter). I'll try to write a test scenario to reproduce this > issue. > > For now, can you tell me if these steps are correct for instantiating and > using highlighter: > > IndexSearcher is = new IndexSearcher(indexReader); > QueryParser parser = new QueryParser(Version.LUCENE_CURRENT, "myfield", > analyzer); > > // allow search terms like "*foo" with leading star > parser.setAllowLeadingWildcard(true); > query = parser.parse(q); > BooleanQuery.setMaxClauseCount(maxClauseCount); > query = query.rewrite(indexReader); > is.setDefaultFieldSortScoring(true, true); > > // > // search code > // > > > // highlightFormatter is a custom impl, which adds a around matched term > Highlighter highlighter = new Highlighter(highlightFormatter, new > QueryScorer(query)); > > TokenStream tokenStream = analyzer.tokenStream("myfield", new > StringReader("text to search in")); > String resultStr = highlighter.getBestFragments(tokenStream, "text to > search in", 100, "..."); > > > Mohsen > > > markrmiller wrote: >> >> Mohsen Saboorian wrote: >>> After updating to 2.9.x or 3.0, highlighter doesn't work on wildcard >>> queries >>> like "abc*". I thought that it would be because of scoring, so I also >>> set >>> myIndexSearcher.setDefaultFieldSortScoring(true, true) before searching. >>> I tested with both QueryScorer and QueryTermScorer. >>> >>> In my custom highlightTerm(String originalText, TokenGroup tokenGroup) >>> method, tokenGroup.getTotalScore() is always <= 0 for these queries. >>> >>> Mohsen >>> >> Can you boil the issue down to a unit test? >> >> -- >> - Mark >> >> http://www.lucidimagination.com >> >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org >> For additional commands, e-mail: java-user-help@lucene.apache.org >> >> >> > > -- View this message in context: http://old.nabble.com/Highlighter-doesn%27t-highlight-wildcard-queries-after-updating-to-2.9.1-3.0.0-tp26969517p27106452.html Sent from the Lucene - Java Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org