Hi Rohan,
I would sugggest you to go with the below document approach. By Using this approach you will be able to sort data for your custom fields, Excel download and put your Z data to your collection before calling Do_prepare_output and get methods.
Search Result Enhancement with custom z fields
Award points if it helps ![]()
Regards,
Sumeet