From f60c89f24f76d57434c3574136fa5cdaf595985a Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Mon, 20 Nov 2017 22:38:28 +0100 Subject: debbugs: Add search-est operation. * debbugs/operations.scm (search-est): New procedure. * doc/guile-debbugs.texi (Operations): Document it. --- debbugs/operations.scm | 24 +++++++++++++++++++++++- doc/guile-debbugs.texi | 13 +++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/debbugs/operations.scm b/debbugs/operations.scm index c76660d..5758471 100644 --- a/debbugs/operations.scm +++ b/debbugs/operations.scm @@ -23,7 +23,8 @@ #:use-module (sxml xpath) #:use-module (sxml match) #:use-module (srfi srfi-1) - #:use-module (ice-9 match)) + #:use-module (ice-9 match) + #:use-module (ice-9 optargs)) (define-public (newest-bugs amount) "Return a list of bug numbers corresponding to the newest AMOUNT @@ -118,3 +119,24 @@ all bugs that have been tagged by EMAIL." (cdr pair)) pair))) tags))))))) + +;; This is not implemented in the Debian deployment of Debbugs. +(define*-public (search-est phrase #:optional (skip 0) (max #f)) + "Return the result of a full text search according to PHRASE. When +SKIP is provided the given number of hits will be skipped; this is +useful for paged results. At most MAX results are returned when MAX +is provided. The number of returned results is always limited by the +absolute maximum returned by the Debbugs server." + (soap-request + `(ns1:search_est + (@ (xmlns:ns1 . "urn:Debbugs/SOAP") + (soapenc:encodingStyle . "http://schemas.xmlsoap.org/soap/encoding/")) + (ns1:phrase + (@ (xsi:type "xsd:string")) ,phrase) + (ns1:skip + (@ (xsi:type "xsd:int")) ,skip) + ,@(if max `(ns1:max + (@ (xsi:type "xsd:int")) ,max) + '())) + ;; TODO: implement response hander + )) diff --git a/doc/guile-debbugs.texi b/doc/guile-debbugs.texi index 615e16c..1b47b86 100644 --- a/doc/guile-debbugs.texi +++ b/doc/guile-debbugs.texi @@ -259,6 +259,19 @@ lists of bug numbers for all bugs that have been tagged by @var{email}, a string holding an email address. @end deffn +@cindex search-est, operation +@deffn {Scheme Procedure} search-est @var{phrase} [@var{skip}] [@var{max}] +Return the result of a full text search according to the string +@var{phrase}. When @var{skip} is provided, the given number of hits +will be skipped; this is useful for paged results. At most @var{max} +results are returned when @var{max} is provided. The number of returned +results is always limited by the absolute maximum returned by the +Debbugs server. + +This operation may not be supported by all Debbugs instances. +@end deffn + + @c ********************************************************************* @node Bug helpers @section Bug helpers -- cgit v1.2.3