Merge pull request 'Suche nutzt nun Tags' (#59) from suchergebnisseTags into dev
Reviewed-on: #59
This commit was merged in pull request #59.
This commit is contained in:
Generated
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="dataSourceStorageLocal" created-in="IU-261.24374.151">
|
<component name="dataSourceStorageLocal" created-in="IU-261.25134.95">
|
||||||
<data-source name="articles" uuid="315cb5c9-2b0f-435b-b602-59823b160908">
|
<data-source name="articles" uuid="315cb5c9-2b0f-435b-b602-59823b160908">
|
||||||
<database-info product="SQLite" version="3.51.1" jdbc-version="4.2" driver-name="SQLite JDBC" driver-version="3.51.1.0" dbms="SQLITE" exact-version="3.51.1" exact-driver-version="3.51">
|
<database-info product="SQLite" version="3.51.1" jdbc-version="4.2" driver-name="SQLite JDBC" driver-version="3.51.1.0" dbms="SQLITE" exact-version="3.51.1" exact-driver-version="3.51">
|
||||||
<identifier-quote-string>"</identifier-quote-string>
|
<identifier-quote-string>"</identifier-quote-string>
|
||||||
|
|||||||
@@ -312,19 +312,18 @@ class DatabaseArticleManager implements ArticleManagerDAO {
|
|||||||
$db = $this->getConnection();
|
$db = $this->getConnection();
|
||||||
|
|
||||||
$sql = "SELECT id, title, content, author, category, tags, created
|
$sql = "SELECT id, title, content, author, category, tags, created
|
||||||
FROM articles
|
FROM articles
|
||||||
WHERE title LIKE :keyword
|
WHERE title LIKE :keyword
|
||||||
OR content LIKE :keyword
|
OR content LIKE :keyword
|
||||||
OR tags LIKE :keyword";
|
OR tags LIKE :keyword;";
|
||||||
|
|
||||||
$command = $db->prepare($sql);
|
$command = $db->prepare($sql);
|
||||||
if (!$command) {
|
if (!$command) {
|
||||||
throw new InternalServerErrorException("internal_error");
|
throw new InternalServerErrorException("internal_error");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wildcards für die Suche hinzufügen
|
// Wildcards für die SQL-Suche hinzufügen
|
||||||
$searchParam = '%' . $cleankeyword . '%';
|
$searchParam = '%' . $cleankeyword . '%';
|
||||||
|
|
||||||
$success = $command->execute([
|
$success = $command->execute([
|
||||||
":keyword" => $searchParam
|
":keyword" => $searchParam
|
||||||
]);
|
]);
|
||||||
@@ -337,10 +336,11 @@ class DatabaseArticleManager implements ArticleManagerDAO {
|
|||||||
$filteredArticles = [];
|
$filteredArticles = [];
|
||||||
|
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
$likes = $this->getLikesForArticle(intval($row['id']));
|
$articleId = intval($row['id']);
|
||||||
|
$likes = $this->getLikesForArticle($articleId);
|
||||||
|
|
||||||
$filteredArticles[] = new Article(
|
$filteredArticles[] = new Article(
|
||||||
intval($row['id']),
|
$articleId,
|
||||||
$row['title'] ?? '',
|
$row['title'] ?? '',
|
||||||
$row['content'] ?? '',
|
$row['content'] ?? '',
|
||||||
$row['author'] ?? '',
|
$row['author'] ?? '',
|
||||||
@@ -358,6 +358,7 @@ class DatabaseArticleManager implements ArticleManagerDAO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holt alle User-IDs, die einen bestimmten Beitrag geliked haben.
|
* Holt alle User-IDs, die einen bestimmten Beitrag geliked haben.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user