File tree Expand file tree Collapse file tree 2 files changed +9
-12
lines changed Expand file tree Collapse file tree 2 files changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -22,9 +22,6 @@ class Response implements ResponseInterface {
22
22
/** @var string SRU protocol version */
23
23
public $ version ;
24
24
25
- /** @var string The CQL query used to generate the response */
26
- public $ query ;
27
-
28
25
/**
29
26
* Create a new response
30
27
*
@@ -40,23 +37,17 @@ public function __construct($text, &$client = null)
40
37
41
38
$ this ->client = $ client ;
42
39
43
- $ doc ->registerXPathNamespaces (array (
40
+ $ this -> response ->registerXPathNamespaces (array (
44
41
'srw ' => 'http://www.loc.gov/zing/srw/ ' ,
45
42
'd ' => 'http://www.loc.gov/zing/srw/diagnostic/ '
46
43
));
47
44
48
- $ this ->version = $ doc -> text ('/srw:searchRetrieveResponse /srw:version ' );
45
+ $ this ->version = $ this -> response -> text ('/srw:* /srw:version ' );
49
46
50
- $ e = $ doc -> first ('/srw:searchRetrieveResponse /srw:diagnostics ' );
47
+ $ e = $ this -> response -> first ('/srw:* /srw:diagnostics ' );
51
48
if ($ e ) {
52
49
$ this ->error = $ e ->text ('d:diagnostic/d:message ' ) . '. ' . $ e ->text ('d:diagnostic/d:details ' );
53
50
}
54
-
55
- // The server may echo the request back to the client along with the response
56
- $ this ->query = $ doc ->text ('/srw:searchRetrieveResponse/srw:echoedSearchRetrieveRequest/srw:query ' ) ?: null ;
57
-
58
- $ this ->response = $ doc ;
59
-
60
51
}
61
52
62
53
/**
Original file line number Diff line number Diff line change @@ -16,6 +16,9 @@ class SearchRetrieveResponse extends Response implements ResponseInterface {
16
16
/** @var int Position of next record in the result set, or null if no such record exist */
17
17
public $ nextRecordPosition ;
18
18
19
+ /** @var string The CQL query used to generate the response */
20
+ public $ query ;
21
+
19
22
/**
20
23
* Create a new searchRetrieve response
21
24
*
@@ -29,6 +32,9 @@ public function __construct($text, &$client = null)
29
32
$ this ->numberOfRecords = (int ) $ this ->response ->text ('/srw:searchRetrieveResponse/srw:numberOfRecords ' );
30
33
$ this ->nextRecordPosition = (int ) $ this ->response ->text ('/srw:searchRetrieveResponse/srw:nextRecordPosition ' ) ?: null ;
31
34
35
+ // The server may echo the request back to the client along with the response
36
+ $ this ->query = $ this ->response ->text ('/srw:searchRetrieveResponse/srw:echoedSearchRetrieveRequest/srw:query ' ) ?: null ;
37
+
32
38
$ this ->records = array ();
33
39
foreach ($ this ->response ->xpath ('/srw:searchRetrieveResponse/srw:records/srw:record ' ) as $ record ) {
34
40
$ this ->records [] = new Record ($ record );
You can’t perform that action at this time.
0 commit comments