On-chip nanophotonic cavities will advance quantum information science and measurement because they enable efficient interaction between photons and long-lived solid-state spins, such as those associated with rare-earth ions in crystals. The enhanced photon-ion interaction creates new opportunities for all-optical control using the ac Stark shift. Toward this end, we characterize the ac Stark interaction between off-resonant optical fields and Nd$^{3+}$-ion dopants in a photonic crystal resonator fabricated from yttrium orthovanadate (YVO$_4$). Using photon echo techniques, at a detuning of 160 MHz we measure a maximum ac Stark shift of 2$pitimes$12.3 MHz per intra-cavity photon, which is large compared to both the homogeneous linewidth ($Gamma_h =$100 kHz) and characteristic width of isolated spectral features created through optical pumping ($Gamma_f approx$3 MHz). The photon-ion interaction strength in the device is sufficiently large to control the frequency and phase of the ions for quantum information processing applications. In particular, we discuss and assess the use of the cavity enhanced ac Stark shift to realize all-optical quantum memory and detection protocols. Our results establish the ac Stark shift as a powerful added control in rare-earth ion quantum technologies.