;; search synonym / query expansion — Haskell source fragment. Depends on index +
;; rank. A synonym map is an assoc list [(Term, [Term])]; a query term is expanded
;; to itself plus its synonyms, then the expanded set is unioned / ranked.
;;   expandTerm    :: [(Term,[Term])] -> Term -> [Term]
;;   synDocs       :: [(Term,[Term])] -> Term -> Index -> [DocId]
;;   synRankTfIdf  :: [(Term,[Term])] -> Term -> Index -> [DocId]

(define
  search/syn-src
  "synLookup synmap t = case lookup t synmap of { Nothing -> [] ; Just ss -> ss }\nexpandTerm synmap t = t : synLookup synmap t\nsynDocs synmap t idx = foldl (candStep idx) [] (expandTerm synmap t)\nsynRankTfIdf synmap t idx = rankTfIdf (expandTerm synmap t) idx\n")
