about summary refs log tree commit diff
path: root/search.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--search.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/search.c b/search.c
index 1cfc0f1..7960d6b 100644
--- a/search.c
+++ b/search.c
@@ -44,8 +44,8 @@ const char *SearchQuery = SQL(
 	LIMIT :offset, :limit;
 );
 
-enum kcgi_err pageSearch(struct kreq *req) {
-	struct Scope scope = htmlScope(req);
+enum kcgi_err searchPage(struct kreq *req) {
+	struct Scope scope = pageScope(req);
 	if (!scope.query) return httpFail(req, KHTTP_400);
 	if (scope.context && !scope.network) return httpFail(req, KHTTP_400);
 
@@ -68,8 +68,8 @@ enum kcgi_err pageSearch(struct kreq *req) {
 	dbBindText(stmt.search, ":network", scope.network);
 	dbBindText(stmt.search, ":context", scope.context);
 	dbBindText(stmt.search, ":query", scope.query);
-	dbBindInt(stmt.search, ":public", pagePublic);
-	dbBindInt(stmt.search, ":limit", pageLimit);
+	dbBindInt(stmt.search, ":public", contextsPublic);
+	dbBindInt(stmt.search, ":limit", eventsLimit);
 	dbBindInt(stmt.search, ":offset", offset);
 	dbBindText(stmt.search, ":highlight", "\26");
 
@@ -88,8 +88,8 @@ enum kcgi_err pageSearch(struct kreq *req) {
 		event.target = sqlite3_column_text(stmt.search, i++);
 		event.message = sqlite3_column_text(stmt.search, i++);
 		error = htmlEvent(&html, scope, event);
-		if (error) break;
+		if (error) return error;
 	}
 	if (result != SQLITE_DONE) errx(EX_SOFTWARE, "%s", sqlite3_errmsg(db));
-	return error || htmlFooter(&html) || khtml_close(&html);
+	return htmlFooter(&html) || khtml_close(&html);
 }