diff --git a/src/base/BaseRepository.php b/src/base/BaseRepository.php
index a8bc49d24c607d38a70e68063aa1208d2d96ae2b..49154a72a3a69c00f2ca7b4f96aeb58db6213077 100644
--- a/src/base/BaseRepository.php
+++ b/src/base/BaseRepository.php
@@ -98,6 +98,7 @@ abstract class BaseRepository
     $pageNo = null,
     $pageSize = null,
     $sort = "asc",
+    $isInitialSync = "no"
   ) {
     $sql = "SELECT * FROM $this->tableName";
 
@@ -124,6 +125,21 @@ abstract class BaseRepository
       $sql .= " WHERE " . implode(" AND ", $conditions);
     }
 
+    if ($isInitialSync == "no") {
+      $pollingDurationMinutes = intval(getenv('POLLING_DURATION_MINUTES'));
+      $pollingSql = "";
+      if (count($where) == 0) {
+        $pollingSql .= " WHERE ";
+      }
+      if ($pollingDurationMinutes !== false && is_numeric($pollingDurationMinutes) && $pollingDurationMinutes) {
+          $pollingSql .= "last_updated >= DATE_SUB(NOW(), INTERVAL $pollingDurationMinutes MINUTE)";
+      } else {
+          $pollingSql .= "last_updated >= DATE_SUB(NOW(), INTERVAL 30 MINUTE)";
+      }
+      $sql .= $pollingSql;
+    }
+
+
     if ($order) {
       $sql .= " ORDER BY $order";
     }
diff --git a/src/repositories/FilmRepository.php b/src/repositories/FilmRepository.php
index ff7f2742399e882f0140bfb6e9dc723311c0d1e0..2b8fb7f0a023d85895523c1b13c96cb93362539d 100644
--- a/src/repositories/FilmRepository.php
+++ b/src/repositories/FilmRepository.php
@@ -36,7 +36,8 @@ class FilmRepository extends BaseRepository
     $genre = 'all',
     $released_year = 'all',
     $pageNo = 1,
-    $limit = 10
+    $limit = 10,
+    $isInitialSync = "no"
   ) {
     $where = [];
 
@@ -47,10 +48,13 @@ class FilmRepository extends BaseRepository
       $where['released_year'] = [$released_year, PDO::PARAM_INT];
     }
     if (isset($word) and !empty($word)) {
-      $where['title'] = [$genre, PDO::PARAM_STR, 'LIKE', ['director']];
+      $where['title'] = [$word, PDO::PARAM_STR, 'LIKE', ['director']];
     }
 
-    return $this->findAll($where, $order, $pageNo, $limit, $isDesc);
+    $data = $this->findAll($where, $order, $pageNo, $limit, $isDesc, $isInitialSync);
+    error_log(count($data));
+
+    return $this->findAll($where, $order, $pageNo, $limit, $isDesc, $isInitialSync);
   }
 
   public function countRowBySearchAndFilter($word, $genre = 'all', $released_year = 'all')
@@ -64,7 +68,7 @@ class FilmRepository extends BaseRepository
       $where['released_year'] = [$released_year, PDO::PARAM_INT];
     }
     if (isset($word) and !empty($word)) {
-      $where['title'] = [$genre, PDO::PARAM_STR, 'LIKE', ['director']];
+      $where['title'] = [$word, PDO::PARAM_STR, 'LIKE', ['director']];
     }
 
     return $this->countRow($where);