--- a/search.php
+++ b/search.php
@@ -1,35 +1,93 @@
-
+createSelect();
+
+// set a query (all prices starting from 12)
+$query->setQuery($_REQUEST['searchKeyword']);
+
+// set start and rows param (comparable to SQL limit) using fluent interface
+$query->setStart(0)->setRows(100);
+
+// set fields to fetch (this overrides the default setting 'all fields')
+$query->setFields(array('id','description','value','agencyName','contractStart','supplierName', 'score'));
+
+// sort the results by price ascending
+//$query->addSort('price', $query::SORT_ASC);
+
+// this executes the query and returns the result
+$resultset = $solr_client->select($query);
+
+// display the total number of documents found by solr
+echo 'Found '.$resultset->getNumFound(). ' results.
';
+
+foreach ($resultset as $row) {
+ foreach ($query->fetchAll() as $row) {
+setlocale(LC_MONETARY, 'en_US');
+ $value = number_format(doubleval($row['value'][0]), 2);
+ echo ("
+ {$row['id']} |
+ {$row['description'][0]} |
+ \$$value | {$row['agencyName'][0]} |
+ {$row['contractStart'][0]} |
+ {$row['supplierName'][0]} |
+
");
+
+*/
+$keyword = $_REQUEST['searchKeyword'];
+ $query = 'SELECT "CNID", "description", "value", "agencyName", "category",
+ "contractStart", "supplierName"
+ FROM contractnotice
+ WHERE ' .$yearQ . ' to_tsvector(\'english\', description) @@ plainto_tsquery(\'english\', :keyword) and "childCN" is null
+ ORDER BY "value" DESC limit 100';
+ $query = $conn->prepare($query);
+ $query->bindParam(":keyword", $keyword);
+ $query->execute();
+ databaseError($conn->errorInfo());
+echo '';
+ foreach ($query->fetchAll() as $row) {
+//print_r($row);
+setlocale(LC_MONETARY, 'en_US');
+ $value = number_format($row['value'], 2);
+ echo ("
+ {$row['CNID']} |
+ {$row['description']} |
+ \$$value | {$row['agencyName']} |
+ {$row['contractStart']} |
+ {$row['supplierName']} |
+
");
+}
+echo "
";
+
+ include_footer();
+}
+?>
+