Changeset 15831 in project


Ignore:
Timestamp:
09/12/09 14:47:29 (10 years ago)
Author:
sjamaan
Message:

Finally get put-document working the way it should

Location:
release/4/estraier-client
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/4/estraier-client/estraier-client.scm

    r15829 r15831  
    7979          (string-drop attrib-line (add1 idx)))))
    8080
     81;; Helper procedure for checking that id xor uri is supplied
     82(define (id/uri->alist id uri)
     83  (cond
     84   ((and id (not uri)) `((id . ,(->string id))))
     85   ((and uri (not id)) `((uri . ,uri)))
     86   (else (error "You must supply either an id or a uri"))))
     87
    8188;;;; Node API
    8289
     
    137144          ;; If control commands or the @digest attribute are sent
    138145          ;; back, the node will silently ignore the document...
    139           (unless (or (string-prefix? "#" (->string attrib))
    140                       (eq? attrib '@digest))
     146          (unless (or (string-prefix? "#" (->string (car attrib)))
     147                      (eq? (car attrib) '@digest))
    141148            (fprintf out "~A=~A\r\n" (car attrib) (cdr attrib))))
    142149        attribs)
     
    155162(define (document-uri->id node uri)
    156163  (exec (node-uri node "uri_to_id" query: `((uri . ,uri))) read-line))
    157 
    158 ;; Helper procedure for checking that id xor uri is supplied
    159 (define (id/uri->alist id uri)
    160   (cond
    161    ((and id (not uri)) `((id . ,(->string id))))
    162    ((and uri (not id)) `((uri . ,uri)))
    163    (else (error "You must supply either an id or a uri"))))
    164164
    165165(define (get-document node #!key id uri)
  • release/4/estraier-client/tests/run.scm

    r15829 r15831  
    121121            "or other"
    122122            (alist-ref 'my-tag meta))
    123       ;; XXX For some reason I can't seem to be able to update an existing
    124       ;; document...
    125123      (test-assert "Putting a modified doc gives no error"
    126124                   (begin
     
    140138        (document-attribute node-uri 'my-tag uri: "/test1"))
    141139
     140  ;; XXX: This makes assumptions about the ordering of the docs in the
     141  ;; result set.  It should not do that :)
    142142  (receive (results meta-data)
    143143    (find-documents node-uri phrase: "test")
    144144    (test "Find-documents finds both docs"
    145           '(((#f . "Just a ") ("test" . "test") (#f . " for estraier"))
    146             ((#f . "Another ") ("test" . "test") (#f . " for estraier")))
     145          '(((#f . "Another ") ("test" . "test") (#f . " for estraier"))
     146            ((#f . "Simply a ") ("test" . "test") (#f . " for estraier")))
    147147          (map car results))
    148148    (test "URI matches put-document"
    149149          "/test1"
    150           (alist-ref '@uri (cdr (car results))))
     150          (alist-ref '@uri (cdr (cadr results))))
    151151    (test "document-uri->id gives result that matches search result details"
    152           (alist-ref '@id (cdr (car results)))
     152          (alist-ref '@id (cdr (cadr results)))
    153153          (document-uri->id node-uri "/test1")))
    154154
Note: See TracChangeset for help on using the changeset viewer.