Rev 6462 | Rev 6516 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
6461 | bpr | 1 | !!##sheet |
6462 | bpr | 2 | basedir=bases/sheet/index |
33 | reyssat | 3 | !if $srch!=$empty |
4 | suffix_dictionary= |
||
6462 | bpr | 5 | dictionary=$basedir/$search_lang |
33 | reyssat | 6 | translator_unknown= |
6470 | bpr | 7 | !if $search_and=yes |
8 | srch=!items2lines $srch |
||
9 | !endif |
||
33 | reyssat | 10 | sout=!exec translator $srch |
6470 | bpr | 11 | !if $search_and=yes |
12 | scnt=!linecnt $srch |
||
13 | Sout=!words2items $(sout[1;]) |
||
14 | !for s=2 to $scnt |
||
15 | S=!words2items $(sout[$s;]) |
||
16 | Sout=!listintersection $Sout and $S |
||
17 | !next |
||
18 | sout=$Sout |
||
19 | !endif |
||
33 | reyssat | 20 | sout=!items2words $sout |
21 | sout=!words2lines $sout |
||
22 | sout=!translate ? to $ $ in $sout |
||
23 | sout=!sort lines $sout |
||
24 | sout=!nonempty lines $sout |
||
25 | scnt=!linecnt $sout |
||
26 | !else |
||
27 | scnt=0 |
||
28 | !endif |
||
29 | |||
30 | # Limit of shown items |
||
31 | gotlim=50 |
||
32 | !distribute item 0,0,, into weight,gotcnt,gotm,gotw,lastmod |
||
33 | |||
34 | !for i=1 to $scnt |
||
35 | l_=!line $i of $sout |
||
36 | t_=!wordcnt $l_ |
||
37 | !if $t_=2 |
||
38 | !distribute word $l_ into m_,w_ |
||
39 | !if $m_=$lastmod or $gotcnt>$gotlim |
||
40 | weight=$[$weight+$w_] |
||
41 | !else |
||
42 | !if $lastmod!=$empty |
||
43 | gotm=$gotm $lastmod |
||
44 | gotw=$gotw $weight |
||
45 | !advance gotcnt |
||
46 | !endif |
||
47 | lastmod=$m_ |
||
48 | weight=$w_ |
||
49 | !endif |
||
50 | !endif |
||
51 | !next i |
||
52 | !if $lastmod!=$empty |
||
53 | gotm=$gotm $lastmod |
||
54 | gotw=$gotw $weight |
||
55 | !advance gotcnt |
||
56 | !endif |
||
57 | |||
58 | translator_switch=leaveline |
||
59 | !if $gotcnt=0 |
||
60 | gottype=popular |
||
61 | !else |
||
62 | gottype=search |
||
63 | gotw=!words2lines $gotw |
||
64 | gotm=!words2lines $gotm |
||
6462 | bpr | 65 | dictionary=$basedir/weight.$search_lang |
33 | reyssat | 66 | gotW=!exec translator $gotm |
67 | w_= |
||
68 | !for i=1 to $gotcnt |
||
69 | u_=!line $i of $gotw |
||
70 | v_=!line $i of $gotW |
||
71 | w_=!append line $[round(100*($u_+1)/($v_+1)^0.7)] to $w_ |
||
72 | !next i |
||
73 | gotw=!sort reverse numeric lines $w_ |
||
74 | gotm=!line $wims_sort_order of $gotm |
||
75 | !endif |
||
76 | |||
6462 | bpr | 77 | dictionary=$basedir/title.$search_lang |
33 | reyssat | 78 | gott=!exec translator $gotm |
6462 | bpr | 79 | dictionary=$basedir/description.$search_lang |
33 | reyssat | 80 | gotd=!exec translator $gotm |
81 | !if $gotcnt>0 and / notin $gotm |
||
6462 | bpr | 82 | dictionary=$basedir/addr.$search_lang |
33 | reyssat | 83 | gotm=!exec translator $gotm |
84 | !endif |
||
85 |