Subversion Repositories wimsdev

Compare Revisions

Ignore whitespace Rev 12820 → Rev 12821

/trunk/wims/public_html/modules/home/search.S
14,48 → 14,48
!distribute item 0,0,, into weight,gotcnt,gotm,gotw,lastmod
 
!for i=1 to $scnt
l_=!line $i of $sout
t_=!wordcnt $l_
!if $t_=2
!distribute word $l_ into m_,w_
!if $m_=$lastmod or $gotcnt>$gotlim
weight=$[$weight+$w_]
!else
!if $lastmod!=$empty
gotm=$gotm $lastmod
gotw=$gotw $weight
!advance gotcnt
!endif
lastmod=$m_
weight=$w_
l_=!line $i of $sout
t_=!wordcnt $l_
!if $t_=2
!distribute word $l_ into m_,w_
!if $m_=$lastmod or $gotcnt>$gotlim
weight=$[$weight+$w_]
!else
!if $lastmod!=$empty
gotm=$gotm $lastmod
gotw=$gotw $weight
!advance gotcnt
!endif
lastmod=$m_
weight=$w_
!endif
!endif
!endif
!next i
!if $lastmod!=$empty
gotm=$gotm $lastmod
gotw=$gotw $weight
!advance gotcnt
gotm=$gotm $lastmod
gotw=$gotw $weight
!advance gotcnt
!endif
 
translator_switch=leaveline
!if $gotcnt=0
gottype=popular
gottype=popular
!else
gottype=search
gotw=!words2lines $gotw
gotm=!words2lines $gotm
dictionary=$basedir/weight.$search_lang
gotW=!exec translator $gotm
w_=
!for i=1 to $gotcnt
u_=!line $i of $gotw
v_=!line $i of $gotW
w_=!append line $[round(100*($u_+1)/($v_+1)^0.7)] to $w_
!next i
gotw=!sort reverse numeric lines $w_
gotm=!line $wims_sort_order of $gotm
gotm=!line 1 to $gotlim2 of $gotm
gotcnt=!linecnt $gotm
gottype=search
gotw=!words2lines $gotw
gotm=!words2lines $gotm
dictionary=$basedir/weight.$search_lang
gotW=!exec translator $gotm
w_=
!for i=1 to $gotcnt
u_=!line $i of $gotw
v_=!line $i of $gotW
w_=!append line $[round(100*($u_+1)/($v_+1)^0.7)] to $w_
!next i
gotw=!sort reverse numeric lines $w_
gotm=!line $wims_sort_order of $gotm
gotm=!line 1 to $gotlim2 of $gotm
gotcnt=!linecnt $gotm
!endif
 
dictionary=$basedir/title.$search_lang
75,6 → 75,6
$ in $gotm
 
!if $gotcnt>0 and / notin $gotm
dictionary=$basedir/addr.$search_lang
gotm=!exec translator $gotm
dictionary=$basedir/addr.$search_lang
gotm=!exec translator $gotm
!endif