You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by reachpratik <pr...@reach1to1.com> on 2012/01/04 14:28:04 UTC

Do Hignlighting + proximity using surround query parser

Hello,
I am not able to do highlighting with surround query parser on the returned
results.
I have tried the highlighting component but it does not return highlighted
results.

Any suggestions would help.


--
View this message in context: http://lucene.472066.n3.nabble.com/Do-Hignlighting-proximity-using-surround-query-parser-tp3631827p3631827.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Do Hignlighting + proximity using surround query parser

Posted by Erick Erickson <er...@gmail.com>.
Please review:
http://wiki.apache.org/solr/UsingMailingLists

You haven't provided enough information for
anyone to provide much help.

Best
Erick

On Wed, Jan 4, 2012 at 8:28 AM, reachpratik <pr...@reach1to1.com> wrote:
> Hello,
> I am not able to do highlighting with surround query parser on the returned
> results.
> I have tried the highlighting component but it does not return highlighted
> results.
>
> Any suggestions would help.
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Do-Hignlighting-proximity-using-surround-query-parser-tp3631827p3631827.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Re: Do Hignlighting + proximity using surround query parser

Posted by Ahmet Arslan <io...@yahoo.com>.
> > I got this working the way you
> > describe it (in the getHighlightQuery()
> > method). The span queries were tripping it up, so I
> > extracted the query
> > terms and created a DisMax query from them. There'll be
> a
> > loss of accuracy
> > in the highlighting, but in my case that's better than
> no
> > highlighting.
> > 
> > Should I just go ahead and submit a patch to
> SOLR-2703?
> 
> I think a separate jira ticket would be more appropriate. 

Scott, I created SOLR-3060 for this.

Re: Do Hignlighting + proximity using surround query parser

Posted by Ahmet Arslan <io...@yahoo.com>.
> I got this working the way you
> describe it (in the getHighlightQuery()
> method). The span queries were tripping it up, so I
> extracted the query
> terms and created a DisMax query from them. There'll be a
> loss of accuracy
> in the highlighting, but in my case that's better than no
> highlighting.
> 
> Should I just go ahead and submit a patch to SOLR-2703?

I think a separate jira ticket would be more appropriate. 

By the way, o.a.l.search.Query#rewrite(IndexReader reader) should do the trick. 

/**
   * Highlighter does not recognize SurroundQuery.
   * It must be rewritten in its most primitive form to enable highlighting.
   */
  @Override
  public Query getHighlightQuery() throws ParseException {

    Query rewritedQuery;

    try {
      rewritedQuery = getQuery().rewrite(getReq().getSearcher().getIndexReader());
    } catch (IOException ioe) {
      rewritedQuery = null;
      LOG.error("query.rewrite() failed", ioe);
    }

    if (rewritedQuery == null)
      return getQuery();
    else
      return rewritedQuery;
  }

Re: Do Hignlighting + proximity using surround query parser

Posted by Scott Stults <ss...@opensourceconnections.com>.
I got this working the way you describe it (in the getHighlightQuery()
method). The span queries were tripping it up, so I extracted the query
terms and created a DisMax query from them. There'll be a loss of accuracy
in the highlighting, but in my case that's better than no highlighting.

Should I just go ahead and submit a patch to SOLR-2703?


On Tue, Jan 10, 2012 at 9:35 AM, Ahmet Arslan <io...@yahoo.com> wrote:

> > I am not able to do highlighting with surround query parser
> > on the returned
> > results.
> > I have tried the highlighting component but it does not
> > return highlighted
> > results.
>
> Highlighter does not recognize Surround Query. It must be re-written to
> enable highlighting in o.a.s.search.QParser#getHighlightQuery() method.
>
> Not sure this functionality should be added in SOLR-2703 or a separate
> jira issue.
>
>


-- 
Scott Stults | Founder & Solutions Architect | OpenSource Connections, LLC
| 434.409.2780
http://www.opensourceconnections.com

Re: Do Hignlighting + proximity using surround query parser

Posted by Ahmet Arslan <io...@yahoo.com>.
> I am not able to do highlighting with surround query parser
> on the returned
> results.
> I have tried the highlighting component but it does not
> return highlighted
> results.

Highlighter does not recognize Surround Query. It must be re-written to enable highlighting in o.a.s.search.QParser#getHighlightQuery() method.

Not sure this functionality should be added in SOLR-2703 or a separate jira issue.