Buggy code:
public class PhraseQuery extends Query { private String field ; private ArrayList < Term > terms = new ArrayList < Term > ( 4 ) ; private ArrayList < Integer > positions = new ArrayList < Integer > ( 4 ) ; private int maxPosition = 0 ; private int slop = 0 ; public PhraseQuery ( ) { } public void setSlop ( int s ) { } public int getSlop ( ) { } public void add ( Term term ) { } public void add ( Term term , int position ) { } public Term [ ] getTerms ( ) { } public int [ ] getPositions ( ) { } @ Override public Query rewrite ( IndexReader reader ) throws IOException { } static class PostingsAndFreq implements Comparable < PhraseQuery . PostingsAndFreq > { final DocsAndPositionsEnum postings ; final int docFreq ; final int position ; final Term term ; public PostingsAndFreq ( DocsAndPositionsEnum postings , int docFreq , int position , Term term ) { } public int compareTo ( PhraseQuery . PostingsAndFreq other ) { } @ Override public int hashCode ( ) { } @ Override public boolean equals ( Object obj ) { } } private class PhraseWeight extends Weight { private final Similarity similarity ; private final Stats stats ; private transient TermContext [ ] states ; public PhraseWeight ( IndexSearcher searcher ) throws IOException { } @ Override public String toString ( ) { } @ Override public Query getQuery ( ) { } @ Override public float getValueForNormalization ( ) { } @ Override public void normalize ( float queryNorm , float topLevelBoost ) { } @ Override public Scorer scorer ( AtomicReaderContext context , ScorerContext scorerContext ) throws IOException { if ( ( terms . size ( ) ) == 0 ) return null ; final IndexReader reader = context . reader ; final Bits liveDocs = reader . getLiveDocs ( ) ; PhraseQuery . PostingsAndFreq [ ] postingsFreqs = new PhraseQuery . PostingsAndFreq [ terms . size ( ) ] ; for ( int i = 0 ; i < ( terms . size ( ) ) ; i ++ ) { final Term t = terms . get ( i ) ; final TermState state = states [ i ] . get ( context . ord ) ; if ( state == null ) { assert termNotInReader ( reader , field , t . bytes ( ) ) : "no<seq2seq4repair_space>termstate<seq2seq4repair_space>found<seq2seq4repair_space>but<seq2seq4repair_space>term<seq2seq4repair_space>exists<seq2seq4repair_space>in<seq2seq4repair_space>reader" ; return null ; } DocsAndPositionsEnum postingsEnum = reader . termPositionsEnum ( liveDocs , t . field ( ) , t . bytes ( ) , state ) ; if ( postingsEnum == null ) { assert ( reader . termDocsEnum ( liveDocs , t . field ( ) , t . bytes ( ) , state ) ) != null : "termstate<seq2seq4repair_space>found<seq2seq4repair_space>but<seq2seq4repair_space>no<seq2seq4repair_space>term<seq2seq4repair_space>exists<seq2seq4repair_space>in<seq2seq4repair_space>reader" ; <START_BUG> throw new IllegalStateException ( ( ( ( ( "field<seq2seq4repair_space>\"" + ( t . field ( ) ) ) + "\"<seq2seq4repair_space>was<seq2seq4repair_space>indexed<seq2seq4repair_space>with<seq2seq4repair_space>Field.omitTermFreqAndPositions=true;<seq2seq4repair_space>cannot<seq2seq4repair_space>run<seq2seq4repair_space>PhraseQuery<seq2seq4repair_space>(term=" ) + ( t . text ( ) ) ) + ")" ) ) ; <END_BUG> } TermsEnum te = reader . fields ( ) . terms ( field ) . getThreadTermsEnum ( ) ; te . seekExact ( t . bytes ( ) , state ) ; postingsFreqs [ i ] = new PhraseQuery . PostingsAndFreq ( postingsEnum , te . docFreq ( ) , positions . get ( i ) . intValue ( ) , t ) ; } if ( ( slop ) == 0 ) { ArrayUtil . mergeSort ( postingsFreqs ) ; } if ( ( slop ) == 0 ) { ExactPhraseScorer s = new ExactPhraseScorer ( this , postingsFreqs , similarity . exactDocScorer ( stats , field , context ) ) ; if ( s . noDocs ) { return null ; } else { return s ; } } else { return new SloppyPhraseScorer ( this , postingsFreqs , similarity , slop , similarity . sloppyDocScorer ( stats , field , context ) ) ; } } private boolean termNotInReader ( IndexReader reader , String field , BytesRef bytes ) throws IOException { } @ Override public Explanation explain ( AtomicReaderContext context , int doc ) throws IOException { } } @ Override public Weight createWeight ( IndexSearcher searcher ) throws IOException { } @ Override public void extractTerms ( Set < Term > queryTerms ) { } @ Override public String toString ( String f ) { } @ Override public boolean equals ( Object o ) { } @ Override public int hashCode ( ) { } }

Fix:
throw new IllegalStateException ( ( ( ( ( "field<seq2seq4repair_space>\"" + ( t . field ( ) ) ) + "\"<seq2seq4repair_space>was<seq2seq4repair_space>indexed<seq2seq4repair_space>without<seq2seq4repair_space>position<seq2seq4repair_space>data;<seq2seq4repair_space>cannot<seq2seq4repair_space>run<seq2seq4repair_space>PhraseQuery<seq2seq4repair_space>(term=" ) + ( t . text ( ) ) ) + ")" ) ) ;