lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mohsen Saboorian <mohs...@gmail.com>
Subject Re: Highlighter doesn't highlight wildcard queries after updating to 2.9.1/3.0.0
Date Mon, 11 Jan 2010 06:50:20 GMT

The problem comes from this method:
org.apache.lucene.search.highlight.WeightedSpanTermExtractor.extract(Query,
Map<String, WeightedSpanTerm>)

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


Mime
View raw message