1- // Copyright (C) 2018 The Delphi Team.
1+ // Copyright (C) 2018 The Delphi Team.
22// See the LICENCE file distributed with this work for additional
33// information regarding copyright ownership.
44//
@@ -20,16 +20,17 @@ import java.util.concurrent.TimeUnit
2020
2121import com .softwaremill .sttp ._
2222import com .softwaremill .sttp .sprayJson ._
23+ import de .upb .cs .swt .delphi .cli .Config
2324import de .upb .cs .swt .delphi .cli .artifacts .SearchResult
24- import de .upb .cs .swt .delphi .cli .{ Config , artifacts }
25+ import de .upb .cs .swt .delphi .cli .artifacts . SearchResultJson . _
2526import spray .json ._
2627
2728import scala .concurrent .duration ._
2829
2930object SearchCommand extends Command with DefaultJsonProtocol {
3031
3132 val searchTimeout = 10 .seconds
32- val TIMEOUT_CODE = 408
33+ val timeoutCode = 408
3334
3435 /**
3536 * Executes the command implementation
@@ -61,15 +62,14 @@ object SearchCommand extends Command with DefaultJsonProtocol{
6162 val end = System .nanoTime()
6263 val took = (end - start).nanos
6364
64- if (res.code == TIMEOUT_CODE ) {
65+ if (res.code == timeoutCode ) {
6566
6667 error.apply(s " The query timed out after ${took.toSeconds} seconds. " +
6768 " To set a longer timeout, use the --timeout option." )
6869 }
6970 val resStr = res.body match {
7071 case Left (v) =>
7172 error.apply(s " Search request failed \n $v" )
72- println(v)
7373 None
7474 case Right (v) =>
7575 Some (v)
@@ -83,7 +83,6 @@ object SearchCommand extends Command with DefaultJsonProtocol{
8383 reportResult.apply(res)
8484 }
8585 if (! (config.raw || res.equals(" " )) || ! config.csv.equals(" " )) {
86- import artifacts .SearchResultJson ._
8786 val jsonArr = res.parseJson.asInstanceOf [JsArray ].elements
8887 val retrieveResults = jsonArr.map(r => r.convertTo[SearchResult ]).toList
8988 onProperSearchResults(retrieveResults)
0 commit comments