Hi, 

I'm using SOLR and Lucene in my application for search. 

I'm facing an issue of highlighting using FastVectorHighlighter not working
when I use PayloadTermQueries as clauses of a BooleanQuery. 

After Debugging I found that In DefaultSolrHighlighter.Java,
fvh.getFieldQuery does not return any term in the termMap. 

FastVectorHighlighter fvh = new FastVectorHighlighter( 
        // FVH cannot process hl.usePhraseHighlighter parameter per-field
basis 
        params.getBool( HighlightParams.USE_PHRASE_HIGHLIGHTER, true ), 
        // FVH cannot process hl.requireFieldMatch parameter per-field basis 
        params.getBool( HighlightParams.FIELD_MATCH, false ) ); 

FieldQuery fieldQuery = fvh.getFieldQuery( query );

The reason of empty termmap is, PayloadTermQuery is discarded while
constructing the FieldQuery. 

void flatten( Query sourceQuery, Collection<Query> flatQueries ){ 
    if( sourceQuery instanceof BooleanQuery ){ 
      BooleanQuery bq = (BooleanQuery)sourceQuery; 
      for( BooleanClause clause : bq.getClauses() ){ 
        if( !clause.isProhibited() ) 
          flatten( clause.getQuery(), flatQueries ); 
      } 
    } 
    else if( sourceQuery instanceof DisjunctionMaxQuery ){ 
      DisjunctionMaxQuery dmq = (DisjunctionMaxQuery)sourceQuery; 
      for( Query query : dmq ){ 
        flatten( query, flatQueries ); 
      } 
    } 
    else if( sourceQuery instanceof TermQuery ){ 
      if( !flatQueries.contains( sourceQuery ) ) 
        flatQueries.add( sourceQuery ); 
    } 
    else if( sourceQuery instanceof PhraseQuery ){ 
      if( !flatQueries.contains( sourceQuery ) ){ 
        PhraseQuery pq = (PhraseQuery)sourceQuery; 
        if( pq.getTerms().length > 1 ) 
          flatQueries.add( pq ); 
        else if( pq.getTerms().length == 1 ){ 
          flatQueries.add( new TermQuery( pq.getTerms()[0] ) ); 
        } 
      } 
    } 
    // else discard queries 
  } 

What is the best way to get highlighting working with Payload Term Queries? 

Thanks 
Nitin

--
View this message in context: 
http://lucene.472066.n3.nabble.com/Solr-Highlighting-not-working-with-PayloadTermQueries-tp3765093p3765093.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to