$conds = array();
$conds[] = $sub . '.address ' . XDB::formatWildcards(XDB::WILDCARD_CONTAINS, $this->value);
if ($this->type != -1) {
- $conds[] = $sub . '.network_type = ' . XDB::format('{?}', $this->type);
+ $conds[] = $sub . '.nwid = ' . XDB::format('{?}', $this->type);
}
return implode(' AND ', $conds);
}
{
$toks = $uf->getNameTokens();
$scores = array();
+
+ // If there weren't any sort tokens, we shouldn't sort by score, sort by NULL instead
+ if (count($toks) == 0) {
+ return 'NULL';
+ }
+
foreach ($toks as $sub => $token) {
$scores[] = XDB::format('SUM(' . $sub . '.score + IF (' . $sub . '.token = {?}, 5, 0) )', $token);
}
public function getUID($pos = 0)
{
- $uids =$this->getUIDList(null, new PlFilter(1, $pos));
+ $uids =$this->getUIDList(null, new PlLimit(1, $pos));
if (count($uids) == 0) {
return null;
} else {
public function getPID($pos = 0)
{
- $pids =$this->getPIDList(null, new PlFilter(1, $pos));
+ $pids =$this->getPIDList(null, new PlLimit(1, $pos));
if (count($pids) == 0) {
return null;
} else {