There is a patch available here for this purpose. It is probably outdated but you could port it to a newer version.
Or, as a second option, you can use java (or groovy or whatever) code and SorlJ api to get your data from the datasource and index it. If your scenario involves a lot of corner cases that would be the easiest in the end.