help.html: put exact matches first in search results

db4
Slava Pestov 2010-09-18 17:55:52 -07:00 committed by Slava Pestov
parent dd3cfb1268
commit 8912253b5c
1 changed files with 6 additions and 2 deletions
basis/help/html

View 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 ;