Funnily enough using the refractive index to discern compounds is the modus operandi of one of the very fist spectrometer made by William Hyde Wollaston in 1802: https://www.en.silicann.com/blog/post/history-of-spectroscop... (disclaimer: I wrote that).
Very cool approach, though it will most probably only work for classification (i.e. what is this sample), whereas NIR spectroscopy (most common when working with organic compounds) allows for quantification of the sample analytes (who much of each analyte is in this sample).