We were trying to solve the exact same problem in our project too.
Unfortunately, we haven't found a solution yet for finding the location on the map to display the popup for the polyline (we would preferably want to display this at the midpoint of the line).
However, we have been able to find a way to get the graphic to display for the selected polyline. We first clone the graphic for each of the search results when creating the list of the results. We use this saved graphic and display it on the graphics layer on the map when the user clicks the search result.
Something like this:
// Fires when the search() method is called and returns its results.
searchWidget.viewModel.on("search-complete", function (evt) {
if (evt.results && evt.results.length > 1) {
// clone the graphic for each search result like so and save it somewhere:
var savedGraphic= evt.results[0].results[0].feature.clone();
}
});