コード例 #1
0
 function count()
 {
     if ($this->total !== null) {
         return $this->total;
     }
     $swish = new Swish($this->index);
     $search = $swish->prepare();
     $results = $search->execute($this->query);
     $this->total = $results->hits;
     return $this->total;
 }
コード例 #2
0
<?php

$h = new Swish("index.swish-e");
$s = $h->prepare();
$s->setSort('swishrank desc');
$results = $s->execute("for");
echo "There are ", $results->hits, " hits\n";
while ($r = $results->nextResult()) {
    printf("%s %d %s\n", $r->swishdocpath, $r->swishrank, $r->name);
}
echo "Done\n";