Modify Results Based on Input via Query Extension
I have created my own pipeline and implemented my own query extension. Based on parameters I pass in to the query extension I would like to modify a field of my results.
- Implemented query extension $foobar(inputA: number)
- Store the number as a global var e.g. _inputA = number;
- In Coveo.onPostProcessResults() I use the _inputA to do some calculation and store it in a field.
Is this the appropriate way to achieve this functionality? My worry is that since this one pipeline handles all incoming requests data will be out of sync. Consider the following example.
- Request A hits pipeline, calling $foobar(inputA: 1), _inputA is set to 1.
- Request B hits pipeline, calling $foobar(inputA: 2), _inputA is set to 2.
- Request A continues execution calling Coveo.OnPostProcessResults().
- Now I am calculating the result for request A using the wrong _inputA value, because Request B has set it.
Is this the correct understanding of pipelines? Or does each request finish before a new one begins?