Gravatar for

Question by ssantosb, Mar 13, 2017 10:47 AM

Thoughts on custom export to Excel implementation

I have already implemented some export to excel functions against our Coveo indexes. I’ve created HTTP get methods I call on our front end that on the back end composes a Coveo query and executes the query against the index. Then it gets the resulting documents and using the OpenXML library builds the Excel and sends it back to the user. In these cases the parameters for the queries are fixed. So I can compose the query server side. All is well.

Now I want to build a custom export to excel link that gets the results from the search page which as you know could have any number of search conditions, whatever the user put in the search box, facets applied, filters added from JavaScript, filtering rules from the Coveo search properties editor etc.

I need to build a export to excel link so a user can export the results they just searched for. The problem with the default Coveo export is all columns are included in the export. We need to specify which columns to export.

How could I get the full query that the user executed? Does the AQ contain the full query? Could I pass that back to my server side code and re-execute it against the index and get the same results the user would see? If so how do I get the AQ?

One of our developers recommends gathering the results already queried for and parsing through them in JavaScript and sending a collection back to generate the Excel. Would this be a better approach? I would be interested in your thoughts. Or maybe is there a different way altogether?

If you have any other insight on this I would appreciate it very much. Thank you, Sybil

0 Reply
Ask a question