Begins construction of a new row filter for this Query.
public field ( $field ) : obj | ||
return | obj | QueryBuilder A partial representation of the new row filter. |
private function testQueryFilterLimitSort() { $limit = 10; $query = new FactualQuery(); $query->limit($limit); $query->sortAsc("name"); $query->field("region")->equal("CA"); try { $res = $this->factual->fetch($this->testTables['global'], $query); } catch (Exception $e) { $this->msg(__METHOD__, false, $e->getMessage()); } if ($res->getStatus() == "ok" && $res->getIncludedRowCount() == $limit) { $this->msg("Limit/Filter/Sort", true); } else { $this->msg("Limit/Filter/Sort", false); } }
print "<b>search</b> for <input class=\"search\" type=\"text\" value=\"" . $q . "\" name=\"q\"/> in "; print "<b>postcode</b> <input class=\"postcode\" type=\"text\" value=\"" . $zip . "\" name=\"postcode\"/>"; print "<input type=\"submit\" value=\"search\">\r\n"; print "<input type=\"checkbox\" name=\"categories\" value=\"312,347\"" . $filter . "/>Only Search Restaurants & Bars"; print "</form>\r\n"; try { /** make the query */ $query = new FactualQuery(); $query->search($q); $query->offset($page * PAGE_SIZE); $query->limit(PAGE_SIZE); $query->includeRowCount(); $query->threshold("default"); // see http://developer.factual.com/search-placerank-and-boost/#existence if ($zip) { $query->field("postcode")->equal($zip); } if ($cats) { $query->field("category_ids")->includesAny(explode(',', $cats)); } $res = $factual->fetch("places-us", $query); $data = $res->getData(); $firstRow = $page * PAGE_SIZE + 1; $lastRow = $firstRow + $res->getIncludedRowCount() - 1; $totRows = count($data); /** search result counts */ print "<div class=\"placecounts\">showing " . number_format($firstRow) . " through " . number_format($lastRow) . " of " . number_format($res->getTotalRowCount()) . " rows:</div>\r\n"; /** search result data **/ print "<div class=\"results\">\r\n"; $cent_lat = 0.0; $cent_lng = 0.0;