private boolean seekPrefix() throws IOException {
    TermsEnum.SeekStatus seekStatus = termsEnum.seekCeil(prefixBuf);

    docIds = null;//invalidate
    switch (seekStatus) {
      case END:
        return false;

      case FOUND:
        postingsEnum = termsEnum.postings(postingsEnum, PostingsEnum.NONE);
        docIds = postingsEnumToIntsRef(postingsEnum, liveDocs);
        if (docIds.length > 0) {
          return true;
        }

        //Pretend we didn't find it; go to next term
        docIds = null;
        if (termsEnum.next() == null) { // case END
          return false;
        }
        //fall through to NOT_FOUND

      case NOT_FOUND:
        //termsEnum must start with prefixBuf to continue
        BytesRef teTerm = termsEnum.term();

        if (teTerm.length > prefixBuf.length) {
          for (int i = 0; i < prefixBuf.length; i++) {
            if (prefixBuf.bytes[prefixBuf.offset + i] != teTerm.bytes[teTerm.offset + i])
              return false;
          }
          if (teTerm.bytes[teTerm.offset + prefixBuf.length] != SEPARATOR_CHAR)
            return false;
          return true;
        }
        return false;
    }
    throw new IllegalStateException(seekStatus.toString());
  }
private boolean seekPrefix ( ) throws IOException { TermsEnum . SeekStatus seekStatus = termsEnum . seekCeil ( prefixBuf ) ; docIds = null ; switch ( seekStatus ) { case END : return false ; case FOUND : postingsEnum = termsEnum . postings ( postingsEnum , PostingsEnum . NONE ) ; docIds = postingsEnumToIntsRef ( postingsEnum , liveDocs ) ; if ( docIds . length > 0 ) { return true ; } docIds = null ; if ( termsEnum . next ( ) == null ) { return false ; } case NOT_FOUND : BytesRef teTerm = termsEnum . term ( ) ; if ( teTerm . length > prefixBuf . length ) { for ( int i = 0 ; i < prefixBuf . length ; i ++ ) { if ( prefixBuf . bytes [ prefixBuf . offset + i ] != teTerm . bytes [ teTerm . offset + i ] ) return false ; } if ( teTerm . bytes [ teTerm . offset + prefixBuf . length ] != SEPARATOR_CHAR ) return false ; return true ; } return false ; } throw new IllegalStateException ( seekStatus . toString ( ) ) ; }
Seeks to prefixBuf or the next term that is prefixed by prefixBuf plus the separator char.
Sets docIds. *