protected void addShingledPhraseQueries(final BooleanQuery mainQuery,final List<Clause> clauses,final Collection<FieldParams> fields,int shingleSize,final float tiebreaker,final int slop) throws SyntaxError {
  if (null == fields || fields.isEmpty() || null == clauses || clauses.size() < shingleSize)   return;
  if (0 == shingleSize)   shingleSize=clauses.size();
  final int lastClauseIndex=shingleSize - 1;
  StringBuilder userPhraseQuery=new StringBuilder();
  for (int i=0; i < clauses.size() - lastClauseIndex; i++) {
    userPhraseQuery.append('"');
    for (int j=0; j <= lastClauseIndex; j++) {
      userPhraseQuery.append(clauses.get(i + j).val);
      userPhraseQuery.append(' ');
    }
    userPhraseQuery.append('"');
    userPhraseQuery.append(' ');
  }
  ExtendedSolrQueryParser pp=createEdismaxQueryParser(this,IMPOSSIBLE_FIELD_NAME);
  pp.addAlias(IMPOSSIBLE_FIELD_NAME,tiebreaker,getFieldBoosts(fields));
  pp.setPhraseSlop(slop);
  pp.setRemoveStopFilter(true);
  pp.makeDismax=true;
  pp.minClauseSize=2;
  Query phrase=pp.parse(userPhraseQuery.toString());
  if (phrase != null) {
    mainQuery.add(phrase,BooleanClause.Occur.SHOULD);
  }
}

protected void addShingledPhraseQueries ( final BooleanQuery mainQuery , final List < Clause > clauses , final Collection < FieldParams > fields , int shingleSize , final float tiebreaker , final int slop ) throws SyntaxError { if ( null == fields || fields . isEmpty ( ) || null == clauses || clauses . size ( ) < shingleSize ) return ; if ( 0 == shingleSize ) shingleSize = clauses . size ( ) ; final int lastClauseIndex = shingleSize - 1 ; StringBuilder userPhraseQuery = new StringBuilder ( ) ; for ( int i = 0 ; i < clauses . size ( ) - lastClauseIndex ; i ++ ) { userPhraseQuery . append ( '"' ) ; for ( int j = 0 ; j <= lastClauseIndex ; j ++ ) { userPhraseQuery . append ( clauses . get ( i + j ) . val ) ; userPhraseQuery . append ( ' ' ) ; } userPhraseQuery . append ( '"' ) ; userPhraseQuery . append ( ' ' ) ; } ExtendedSolrQueryParser pp = createEdismaxQueryParser ( this , IMPOSSIBLE_FIELD_NAME ) ; pp . addAlias ( IMPOSSIBLE_FIELD_NAME , tiebreaker , getFieldBoosts ( fields ) ) ; pp . setPhraseSlop ( slop ) ; pp . setRemoveStopFilter ( true ) ; pp . makeDismax = true ; pp . minClauseSize = 2 ; Query phrase = pp . parse ( userPhraseQuery . toString ( ) ) ; if ( phrase != null ) { mainQuery . add ( phrase , BooleanClause . Occur . SHOULD ) ; } }
modifies the main query by adding a new optional query consisting of shingled phrase queries across the specified clauses using the specified field = & gt ; boost mappings .
