You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Jason Nacional (JIRA)" <ji...@apache.org> on 2013/02/04 01:14:13 UTC

[jira] [Comment Edited] (LUCENE-4743) ComplexPhraseQuery highlight problem after rewriting using ComplexPhraseQuery.rewrite(IndexReader)

    [ https://issues.apache.org/jira/browse/LUCENE-4743?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13569935#comment-13569935 ] 

Jason Nacional edited comment on LUCENE-4743 at 2/4/13 12:14 AM:
-----------------------------------------------------------------

Thanks all for the quick response. I can provide you some sample query:

Let's say we have the following line: Make Sure Our Emails Reach Your Inbox

the query is: "(Make Sur*) Inbox"~10

after searching, the hits are correct. but somehow "Make" is not being highlighted. Am I missing something here? here is my code.

{code:title=DocHighlighter.java|borderStyle=solid}
...
Query rewrite_result = phrase.rewrite(IndexReader.open(INDEX_DIR));
QueryScorer qs_phrases = new QueryScorer(rewrite_result);
qs_phrases.setExpandMultiTermQuery(true);
highlighter = new Highlighter(htmlFormatter, qs_phrases);
highlighter.setTextFragmenter(new NullFragmenter());
highlighter.setMaxDocCharsToAnalyze(Integer.MAX_VALUE);
//get the temp text
if(text == null){
text = highlighter.getBestFragment(analyzer, "", pText);
}else{
text_temp = highlighter.getBestFragment(analyzer, "", text);
text = text_temp;
}
...
{code}

I'll start to create a test case for more info.
                
      was (Author: jason.nacional):
    Thanks all for the quick response. I can provide you some sample queries:

Let's say we have the following line: Make Sure Our Emails Reach Your Inbox

the query is: "(Make Sur*) Inbox"~10

after searching, the hits are correct. but somehow "Make" is not being highlighted. Am I missing something here? here is my code.

{code:title=DocHighlighter.java|borderStyle=solid}
...
Query rewrite_result = phrase.rewrite(IndexReader.open(INDEX_DIR));
QueryScorer qs_phrases = new QueryScorer(rewrite_result);
qs_phrases.setExpandMultiTermQuery(true);
highlighter = new Highlighter(htmlFormatter, qs_phrases);
highlighter.setTextFragmenter(new NullFragmenter());
highlighter.setMaxDocCharsToAnalyze(Integer.MAX_VALUE);
//get the temp text
if(text == null){
text = highlighter.getBestFragment(analyzer, "", pText);
}else{
text_temp = highlighter.getBestFragment(analyzer, "", text);
text = text_temp;
}
...
{code}

I'll start to create a test case for more info.
                  
> ComplexPhraseQuery highlight problem after rewriting using ComplexPhraseQuery.rewrite(IndexReader)
> --------------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-4743
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4743
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: core/search, modules/queryparser
>    Affects Versions: 3.6.2
>            Reporter: Jason Nacional
>              Labels: complexqueryparser, newbie, queryparser
>
> Just want to ask an assistance using ComplexPhraseQuery. I mean, when it comes to highlighting the hits are not correct. I also started using ComplexPhraseQueryParser to support complex proximity searches.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
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