watson-developer-cloud / node-red-node-watson

A collection of nodes for the IBM Watson services
Apache License 2.0
82 stars 86 forks source link

Watson Discovery "query_options" in node-red #385

Closed mindrefugee closed 6 years ago

mindrefugee commented 6 years ago

Hello. I am Taka.

I would like to use a highlighted query result on Watson discovery in Node-red Web App.

https://stackoverflow.com/questions/49107298/watson-discovery-highlight?answertab=votes#tab-top chughts told me query_options in Watson discovery has not be implemented yet in node-red. (Thanks.)

I woudl like to ask you that "query_options" is implemented in Node-red. I think it is so usefull if we use a highlighted results in Node-red.

thanks.

chughts commented 6 years ago

Do you have a sample flow, with expected results, that we can use to test this change?

mindrefugee commented 6 years ago

Hi chughts. I created a sample flow. (I am not sure that this is what you want to see exactry. Please tell me if you need more,)

  1. We would like to set query_options in the function node "function:query". In this example we set query_options that highlight is true as in https://www.ibm.com/watson/developercloud/discovery/api/v1/?node#query-collection . Sorry I don't know how should be set highlight option exactry. Anyway, we would like to have the way to set highlight something like this example.

2 We would like to recieve highlighted result as "msg.search_results.result[i].highlight" in the function node "function:output filename"(sorry confusing name). We expected a part of the text with em-tag in highlight.html ot highlight.text as same as we obtain it in Watson Discovery sololy. (It seems that highlight.text texts with em tag only is sutable for us. )

thanks.

highlight_test.zip

mindrefugee commented 6 years ago

Sorry! previous example contains multi-byte character staring. I removed them. If you need more informations, please let me now. thanks.

highlight_test.zip

chughts commented 6 years ago

Many of the query options are already available. The option to accept the highlight option has been added in release 0.6.8. Set it by setting msg.discoveryparams.highlight which is the same syntax for the other query options.

chughts commented 6 years ago

0.6.8 released

mindrefugee commented 6 years ago

Thanks ! I will try it.

mindrefugee commented 6 years ago

Just a report. Updates works for us very well. Thanks.