]> gitweb.factorcode.org Git - factor.git/commitdiff
help.html: put exact matches first in search results
authorSlava Pestov <slava@user-64-9-237-49.googlewifi.com>
Sun, 19 Sep 2010 00:55:52 +0000 (17:55 -0700)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Tue, 21 Sep 2010 04:36:20 +0000 (21:36 -0700)
basis/help/html/html.factor

index feb24e732d786deff8cb11f3f805d3df9e09a519..eeaeaf7c41235ab44f6a2a09fd7b0a375dd5c96d 100644 (file)
@@ -113,11 +113,15 @@ MEMO: load-index ( name -- index )
 
 TUPLE: result title href ;
 
+: partition-exact ( string results -- results' )
+    [ title>> = ] with partition append ;
+
 : offline-apropos ( string index -- results )
-    load-index swap >lower
+    load-index over >lower
     '[ [ drop _ ] dip >lower subseq? ] assoc-filter
     [ swap result boa ] { } assoc>map
-    [ title>> ] sort-with ;
+    [ title>> ] sort-with
+    partition-exact ;
 
 : article-apropos ( string -- results )
     "articles.idx" offline-apropos ;