Subversion Repositories wimsdev

Rev

Rev 6470 | Rev 6692 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
33 reyssat 1
# This is the search kernel routine. To be replaced by a c program,
2
# when the intermediate output risks to overflow.
3
#
4
# Input parameters:
2725 bpr 5
# srch, search_category, gotlim, gotlim2
33 reyssat 6
#
7
# Output variables:
8
# gotm, gotw, gotcnt
9
# gotw is only for debugging uses.
10
!nocache
2725 bpr 11
!default search_lang=$lang
6470 bpr 12
 
33 reyssat 13
!if $srch!=$empty
14
 suffix_dictionary=
2670 bpr 15
 dictionary=$search_package2/$search_category.$search_lang
33 reyssat 16
 translator_unknown=
6516 bpr 17
 !read search.common
33 reyssat 18
!else
19
 scnt=0
20
!endif
21
 
22
!distribute item 0,0,, into weight,gotcnt,gotm,gotw,lastmod
23
 
24
!for i=1 to $scnt
25
 l_=!line $i of $sout
26
 t_=!wordcnt $l_
27
 !if $t_=2
28
  !distribute word $l_ into m_,w_
29
  !if $m_=$lastmod
30
   weight=$[$weight+$w_]
31
  !else
32
   !if $lastmod!=$empty
33
    gotm=$gotm $lastmod
34
    gotw=$gotw $weight
35
    !advance gotcnt
36
    !if $gotcnt>=$gotlim
37
     !goto bailout
38
    !endif
39
   !endif
40
   lastmod=$m_
41
   weight=$w_
42
  !endif
43
 !endif
44
!next i
45
:bailout
46
!if $lastmod!=$empty and $gotcnt<$gotlim
47
 gotm=$gotm $lastmod
48
 gotw=$gotw $weight
49
 !advance gotcnt
50
!endif
51
 
52
!if $gotcnt>0
53
 translator_switch=leavelines
54
 translator_unknown=200
55
 gotw=!words2lines $gotw
56
 gotm=!words2lines $gotm
2670 bpr 57
 dictionary=$search_package2/weight.$search_lang
33 reyssat 58
 gotW=!exec translator $gotm
59
 dictionary=$search_package2/popular.1
60
 gotp=!exec translator $gotm
61
 w_=
62
 !for i=1 to $gotcnt
63
  u_=!line $i of $gotw
64
  v_=!line $i of $gotW
65
  p_=!line $i of $gotp
66
  !bound p_ between integer 0 and 1000000 default 0
67
  w_=!append line $[round(100*($u_+1)*($p_+10)^0.4/($v_+1)^0.7)] to $w_
68
 !next i
69
 gotw=!sort reverse numeric lines $w_
70
 gotm=!line $wims_sort_order of $gotm
71
 gotm=!line 1 to $gotlim2 of $gotm
72
 gotcnt=!linecnt $gotm
73
!endif