code: func NewTermContext(ctx IndexReaderContext) *TermContext {
  	// assert ctx != nil && ctx.IsTopLevel
  	var n int
  	if ctx.Leaves() == nil {
  		n = 1
  	} else {
  		n = len(ctx.Leaves())
  	}
  	return &TermContext{TopReaderContext: ctx, states: make([]TermState, n)}
  }
docs: /**
   * Creates an empty {@link TermContext} from a {@link IndexReaderContext}
   */