1
- // Copyright (C) 2018 The Delphi Team.
1
+ // Copyright (C) 2018 The Delphi Team.
2
2
// See the LICENCE file distributed with this work for additional
3
3
// information regarding copyright ownership.
4
4
//
@@ -20,16 +20,17 @@ import java.util.concurrent.TimeUnit
20
20
21
21
import com .softwaremill .sttp ._
22
22
import com .softwaremill .sttp .sprayJson ._
23
+ import de .upb .cs .swt .delphi .cli .Config
23
24
import 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 . _
25
26
import spray .json ._
26
27
27
28
import scala .concurrent .duration ._
28
29
29
30
object SearchCommand extends Command with DefaultJsonProtocol {
30
31
31
32
val searchTimeout = 10 .seconds
32
- val TIMEOUT_CODE = 408
33
+ val timeoutCode = 408
33
34
34
35
/**
35
36
* Executes the command implementation
@@ -61,15 +62,14 @@ object SearchCommand extends Command with DefaultJsonProtocol{
61
62
val end = System .nanoTime()
62
63
val took = (end - start).nanos
63
64
64
- if (res.code == TIMEOUT_CODE ) {
65
+ if (res.code == timeoutCode ) {
65
66
66
67
error.apply(s " The query timed out after ${took.toSeconds} seconds. " +
67
68
" To set a longer timeout, use the --timeout option." )
68
69
}
69
70
val resStr = res.body match {
70
71
case Left (v) =>
71
72
error.apply(s " Search request failed \n $v" )
72
- println(v)
73
73
None
74
74
case Right (v) =>
75
75
Some (v)
@@ -83,7 +83,6 @@ object SearchCommand extends Command with DefaultJsonProtocol{
83
83
reportResult.apply(res)
84
84
}
85
85
if (! (config.raw || res.equals(" " )) || ! config.csv.equals(" " )) {
86
- import artifacts .SearchResultJson ._
87
86
val jsonArr = res.parseJson.asInstanceOf [JsArray ].elements
88
87
val retrieveResults = jsonArr.map(r => r.convertTo[SearchResult ]).toList
89
88
onProperSearchResults(retrieveResults)
0 commit comments