Grokbase Groups Lucene dev July 2011
FAQ
Lucene highlighting unable to extract terms from sub-query of a FunctionQuery
-----------------------------------------------------------------------------

Key: SOLR-2681
URL: https://issues.apache.org/jira/browse/SOLR-2681
Project: Solr
Issue Type: Bug
Components: highlighter
Affects Versions: 3.3
Reporter: Nicolas Marchildon


When using a function query with an argument being a term query, I would expect the highlighter to be able to extract the term.

Lucene's WeightedSpanTermExtractor used by QueryScorer does not know about FunctionQuery, so it is not able to recurse into it for extracting terms.

Here's a HighlighterTest that I believe reproduces the behavior I'm seeing:

{code}
public void testHighlightFunction() {
assertU(adoc("t_text", "lorem ipsum", "id", "1"));
assertU(commit());
assertQ("function highlighting",
req("q", "{!func}product($v1,$v2)", "v1", "{!dismax qf=t_text}lorem", "v2", "100.0", "hl", "true", "hl.fl", "t_text"),
"//lst[@name='highlighting']/lst[@name='1']" +
"/arr[@name='t_text']/str='<em>lorem</em> ipsum'");
}
{code}

The WeightedSpanTermExtractor does many {{instanceof}}, in which Solr's FunctionQuery is unknown. Solr should provide a QueryScorer that knows how to extract terms from a QueryValueSource inside a FunctionQuery.

Here's the stack that leads to the term extraction:

{code}
Thread [main] (Suspended (breakpoint at line 106 in WeightedSpanTermExtractor))
WeightedSpanTermExtractor.extract(Query, Map) line: 106
WeightedSpanTermExtractor.getWeightedSpanTerms(Query, TokenStream, String) line: 414
QueryScorer.initExtractor(TokenStream) line: 216
QueryScorer.init(TokenStream) line: 184
Highlighter.getBestTextFragments(TokenStream, String, boolean, int) line: 226
Highlighter.getBestFragments(TokenStream, String, int) line: 184
Highlighter.getBestFragment(TokenStream, String) line: 107
Highlighter.getBestFragment(Analyzer, String, String) line: 85
{code}


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdev @
categorieslucene
postedJul 28, '11 at 4:35p
activeJul 28, '11 at 4:35p
posts1
users1
websitelucene.apache.org

1 user in discussion

Nicolas Marchildon (JIRA): 1 post

People

Translate

site design / logo © 2021 Grokbase