diff --git a/collects/help/private/search.ss b/collects/help/private/search.ss index e17cdf78..cdb78587 100644 --- a/collects/help/private/search.ss +++ b/collects/help/private/search.ss @@ -5,7 +5,8 @@ "manuals.ss" (lib "list.ss") (lib "plt-match.ss") - (lib "contract.ss")) + (lib "contract.ss") + (lib "dirs.ss" "setup")) (provide doc-collections-changed) (provide/contract @@ -33,6 +34,7 @@ (non-regexp (string? . -> . string?))) + (define doc-dirs (get-doc-search-dirs)) ; These are set by reset-doc-lists: ; docs, doc-names and doc-kinds are parallel lists. doc-kinds @@ -44,8 +46,12 @@ ; doc-kinds : (list-of symbol) (define doc-kinds null) ; doc-collection-date : (union #f number 'none) - (define doc-collection-date #f) + (define doc-collection-dates (map (lambda (x) #f) doc-dirs)) + (define (dir-date/none dir) + (with-handlers ([exn:fail:filesystem? (lambda (x) 'none)]) + (file-or-directory-modify-seconds dir))) + (define (reset-doc-lists) ; Locate standard HTML documentation (define-values (std-docs std-doc-names) @@ -64,10 +70,7 @@ txt-doc-names))) (set! doc-kinds (append (map (lambda (x) 'html) std-docs) (map (lambda (x) 'text) txt-docs))) - (with-handlers ([exn:fail:filesystem? (lambda (x) (set! doc-collection-date 'none))]) - (set! doc-collection-date - (file-or-directory-modify-seconds - (collection-path "doc"))))) + (set! doc-collection-dates (map dir-date/none doc-dirs))) (define MAX-HIT-COUNT 300) @@ -284,7 +287,7 @@ (string->list s))))) (define (doc-collections-changed) - (set! doc-collection-date #f) + (set! doc-collection-dates (map (lambda (x) #f) doc-dirs)) (set! html-keywords (make-hash-table 'equal)) (set! html-indices (make-hash-table 'equal)) (set! text-keywords (make-hash-table 'equal)) @@ -325,11 +328,18 @@ add-doc-section add-kind-section add-choice) ; When new docs are installed, the directory's modification date changes: (set! max-reached #f) - (unless (eq? doc-collection-date 'none) - (when (or (not doc-collection-date) - (> (file-or-directory-modify-seconds (collection-path "doc")) - doc-collection-date)) - (reset-doc-lists))) + + (when (ormap (lambda (date new-date) + (cond + [(not date) #t] + [(equal? date new-date) #f] + [(eq? date 'none) #t] + [(eq? new-date 'none) #t] + [else (new-date . > . date)])) + doc-collection-dates + (map dir-date/none doc-dirs)) + (reset-doc-lists)) + (let ([hit-count 0]) (let-values ([(string-finds finds) (build-string-finds/finds given-find regexp? exact?)] [(filtered-docs filtered-doc-names filtered-doc-kinds)