> 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;
  }

Reply via email to