private Query analyzeMultiBoolean(String field,TokenStream stream,BooleanClause.Occur operator) throws IOException {
  BooleanQuery.Builder q=newBooleanQuery();
  List<Term> currentQuery=new ArrayList<>();
  TermToBytesRefAttribute termAtt=stream.getAttribute(TermToBytesRefAttribute.class);
  PositionIncrementAttribute posIncrAtt=stream.getAttribute(PositionIncrementAttribute.class);
  stream.reset();
  while (stream.incrementToken()) {
    if (posIncrAtt.getPositionIncrement() != 0) {
      add(q,currentQuery,operator);
      currentQuery.clear();
    }
    currentQuery.add(new Term(field,termAtt.getBytesRef()));
  }
  add(q,currentQuery,operator);
  return q.build();
}

private Query analyzeMultiBoolean ( String field , TokenStream stream , BooleanClause . Occur operator ) throws IOException { BooleanQuery . Builder q = newBooleanQuery ( ) ; List < Term > currentQuery = new ArrayList < > ( ) ; TermToBytesRefAttribute termAtt = stream . getAttribute ( TermToBytesRefAttribute . class ) ; PositionIncrementAttribute posIncrAtt = stream . getAttribute ( PositionIncrementAttribute . class ) ; stream . reset ( ) ; while ( stream . incrementToken ( ) ) { if ( posIncrAtt . getPositionIncrement ( ) != 0 ) { add ( q , currentQuery , operator ) ; currentQuery . clear ( ) ; } currentQuery . add ( new Term ( field , termAtt . getBytesRef ( ) ) ) ; } add ( q , currentQuery , operator ) ; return q . build ( ) ; }
creates complex boolean query from the cached tokenstream contents
