Subversion Repositories wimsdev

Rev

Rev 6462 | Rev 6516 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

!!##sheet
basedir=bases/sheet/index
!if $srch!=$empty
 suffix_dictionary=
 dictionary=$basedir/$search_lang
 translator_unknown=
 !if $search_and=yes
   srch=!items2lines $srch
 !endif
 sout=!exec translator $srch
 !if $search_and=yes
   scnt=!linecnt $srch
   Sout=!words2items $(sout[1;])
   !for s=2 to $scnt
     S=!words2items $(sout[$s;])
     Sout=!listintersection $Sout and $S
   !next
    sout=$Sout
 !endif
 sout=!items2words $sout
 sout=!words2lines $sout
 sout=!translate ? to $ $ in $sout
 sout=!sort lines $sout
 sout=!nonempty lines $sout
 scnt=!linecnt $sout
!else
 scnt=0
!endif

# Limit of shown items
gotlim=50
!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_
  !endif
 !endif
!next i
!if $lastmod!=$empty
 gotm=$gotm $lastmod
 gotw=$gotw $weight
 !advance gotcnt
!endif

translator_switch=leaveline
!if $gotcnt=0
 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
!endif

dictionary=$basedir/title.$search_lang
gott=!exec translator $gotm
dictionary=$basedir/description.$search_lang
gotd=!exec translator $gotm
!if $gotcnt>0 and / notin $gotm
 dictionary=$basedir/addr.$search_lang
 gotm=!exec translator $gotm
!endif