You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So, while testing, I found that the special semantics of setting the numberOfRecords to -1 as described in the SRUSearchResultSet of fcs-sru-server is not exactly specified in any specification. Client libraries (like fcs-sru-client) ignore this, too! So following the doc string will lead to invalid and unexpected behavior.
→ So either the doc string has to be adjusted and something should be added to the FCS specification as well as updates to fcs-sru-client.
* The number of records matched by the query. If the query fails this must
* be 0. If the search engine cannot determine the total number of matched
* by a query, it must return -1.
*
* @return the total number of results or 0 if the query failed or -1 if the
* search engine cannot determine the total number of results
*/
publicabstractintgetTotalRecordCount();
The number of records matched by the query. If the query fails this must be 0. If the search engine cannot determine the total number of matched by a query, it must return -1.
The value is simply parsed from the XML, it defaults to -1 for invalid cases, e.g. if the surrounding element is not there or can't be parsed. This also should not happen since required=true is set, so rather than a default value, an exception will be thrown...
This only checks for numberOfRecords > 0 and processes results normally. For -1 it does error analysis and in (default) strict mode throws an exception ...
L314 / §7.2 - <numberOfRecords>; only zero if failure
L339 / §7.6 - <resultCountPrecision>; might describe unknown result count but nothing about any special value of the <numberOfRecords> or how to set it when the result count is unknown.
The text was updated successfully, but these errors were encountered:
The missing check for -1 is an error in the implementation. It was planned to enable the search engine implemenation to provide more detail and allow the sru server to be more smart about "search failed" vs "no results" case, i.e. in case of 0 it could automatically set resultCountPrecision to unknown in the SRU 2.0 case
So, while testing, I found that the special semantics of setting the
numberOfRecords
to-1
as described in theSRUSearchResultSet
offcs-sru-server
is not exactly specified in any specification. Client libraries (likefcs-sru-client
) ignore this, too! So following the doc string will lead to invalid and unexpected behavior.→ So either the doc string has to be adjusted and something should be added to the FCS specification as well as updates to
fcs-sru-client
.Details
declaration >
getTotalRecordCount
fcs-sru-server/src/main/java/eu/clarin/sru/server/SRUSearchResultSet.java
Lines 58 to 66 in 0091fca
serialization >
numberOfRecords
fcs-sru-server/src/main/java/eu/clarin/sru/server/SRUServer.java
Lines 422 to 426 in 0091fca
The value is written as is.
handling of
numberOfRecords
infcs-sru-client
library (working according to specs)https://github.com/clarin-eric/fcs-sru-client/blob/18f2bab01b342cf9095db8cfedb10e5b4e9d54da/src/main/java/eu/clarin/sru/client/SRUSimpleClient.java#L938-L940
The value is simply parsed from the XML, it defaults to
-1
for invalid cases, e.g. if the surrounding element is not there or can't be parsed. This also should not happen sincerequired=true
is set, so rather than a default value, an exception will be thrown...https://github.com/clarin-eric/fcs-sru-client/blob/18f2bab01b342cf9095db8cfedb10e5b4e9d54da/src/main/java/eu/clarin/sru/client/SRUSimpleClient.java#L955
This only checks for
numberOfRecords > 0
and processes results normally. For-1
it does error analysis and in (default) strict mode throws an exception ...Specs
FCS 2.0
searchRetrieve
?SRU 1.2
<numberofRecords>
; only zero if failureSRU 2.0
<numberOfRecords>
; only zero if failure<resultCountPrecision>
; might describe unknown result count but nothing about any special value of the<numberOfRecords>
or how to set it when the result count is unknown.The text was updated successfully, but these errors were encountered: