Lucidworks Fusion 4.1 transform result documents using Javascript query pipeline

392 views Asked by At

How can I transform solr response using JavaScript query Pipeline in Lucidworks Fusion 4.1? For example I have the following response:

[ 
   { "doc_type":"type1",
     "publicationDate":"2018/10/10",
     "sortDate":"2017/9/9"},
   { "doc_type":"type2",
     "publicationDate":"2018/5/5",
     "sortDate":"2017/12/12"}]

And I need to change it with the following conditions:

If doc_type = type1 then put sortDate in publicationDate and remove sortDate; else only remove sortDate

How can I manipulate with response? There is no documentation in official website

1

There are 1 answers

0
Terry Chambers - Onix On BEST ANSWER

Currently, you cannot modify the Solr response. All you can do is add to it. So you could add a new block of JSON, include the "id" of the item and then list the fields and values you want to use in your UI.

Otherwise, you need to make the change in your Index Pipeline (as long as the value doesn't need to change based on the query).