Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 31s
prefixTerms matches indexed terms by prefix (allTerms + isPrefixOf); prefixDocs unions their docs; prefixRankTfIdf ranks via the matched terms. 136/136. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
11 lines
699 B
Plaintext
11 lines
699 B
Plaintext
;; search prefix / wildcard queries — Haskell source fragment. Depends on index +
|
|
;; rank (reuses candStep / rankTfIdf). A prefix matches every indexed term that
|
|
;; starts with it; the matching terms are unioned (OR) into a docid set.
|
|
;; prefixTerms :: String -> Index -> [Term] (sorted, from allTerms)
|
|
;; prefixDocs :: String -> Index -> [DocId] (sorted union)
|
|
;; prefixRankTfIdf :: String -> Index -> [DocId] (ranked by the matched terms)
|
|
|
|
(define
|
|
search/prefix-src
|
|
"prefixTerms pre idx = filter (isPrefixOf pre) (allTerms idx)\nprefixDocs pre idx = foldl (candStep idx) [] (prefixTerms pre idx)\nprefixRankTfIdf pre idx = rankTfIdf (prefixTerms pre idx) idx\n")
|